使用dateFormat读取DatePicker选择的日期值返回未选择日期时的最小日期值?

时间:2016-05-21 04:44:45

标签: javascript jquery jquery-ui-datepicker date-format

我有一个与文本框一起使用的datepicker控件来显示日历日期。

➜  website git:(master) ✗ gulp css
[09:52:08] Using gulpfile ~/my-projects/website/gulpfile.js
[09:52:08] Starting 'css'...
[09:52:08] 'css' errored after 12 ms
[09:52:08] Error: must provide pattern
    at new GlobSync (/Users/jitendravyas/my-projects/website/node_modules/glob/sync.js:29:11)
    at Function.globSync [as sync] (/Users/jitendravyas/my-projects/website/node_modules/glob/sync.js:24:10)
    at /Users/jitendravyas/my-projects/website/node_modules/gulp-ruby-sass/index.js:68:21
    at Array.forEach (native)
    at gulpRubySass (/Users/jitendravyas/my-projects/website/node_modules/gulp-ruby-sass/index.js:67:10)
    at /Users/jitendravyas/my-projects/website/gulpfile.js:48:15
    at taskWrapper (/Users/jitendravyas/my-projects/website/node_modules/undertaker/lib/set-task.js:13:15)
    at bound (domain.js:287:14)
    at runBound (domain.js:300:12)
    at asyncRunner (/Users/jitendravyas/my-projects/website/node_modules/async-done/index.js:36:18)

在js文件中,我将此值读为:

 @Html.TextBoxFor(x => x.CheckDate, new
                                    {
                                        @class = "text_dropdown_corner text-forty-seven-percent",
                                        data_datepicker = "true",
                                        size = 11,
                                        data_min_date = DateTime.Today
                                    })

使用data_min_date,因为日历中的日期受到限制。 使用dateFormat,因为我将此日期作为json发送到控制器。

即使没有为日历控件选择任何值,dateFormat也会将值返回为DateTime.Today。 如果没有选择值,我需要显示null或空值作为日期。 对此有何解决方案?

0 个答案:

没有答案