jquery ui datepicker后退按钮跃升至1899年

我必须错过一些设置或其他东西,但当我使用后退按钮时,datepicker从当前年份跳到1899。

还有其他人看过这个并修好了吗?

(你可以看到我注释掉的不同组合。)

$('.dialog-search,#from') .datepicker({ defaultDate: 'c-1m', dateFormat: 'yymmdd', //changeMonth: true, changeYear: true, showAnim: 'fadeIn', duration: 200, //gotoCurrent: true, showOtherMonths: true, selectOtherMonths: true, currentText: 'Now', shortYearCutoff: '+20', //showWeek: true, //firstDay: 1, numberOfMonths: 1, showButtonPanel: true, yearRange: 'c-200:c', onSelect: function(selectedDate,inst) { $('.dialog-search,#from').val(selectedDate); } }); 

当我有多个具有相同ID的文本输入时,我遇到了这个问题,当你在同一个模型类的页面上有多个编辑器时,很容易使用MVC框架。 我通过显式指定Id并将Name保持原样来解决它,因此模型解析适用于回发。

这是因为在我当前的项目中有多个具有相同id的输入字段。

我在前端生成了多个表单,在我的框架中使用相同的创建方法。

为了避免在表单创建级别编写显式更改,我执行了以下操作:

 //An initialisation method for datepickers var init_datepickers = function() { /* Datepickers */ $('.datepicker').datepicker({ dateFormat: "dd/mm/yy" //(I'm in NZ) }); } //Define counter ("datepicker index" aka dpi) var dpi = 0; //Loop datepickers $.each($('input.datepicker'), function() { if(dpi > 0) $(this).attr("id", $(this).attr("id") + "_" + dpi); //Append the current count to the ID dpi++; //Check for last datepicker, and call init if(dpi == $('input.datepicker').length) init_datepickers(); }); 

我打电话时遇到过这个问题

 $(...).datepicker('destroy') 

在重新初始化datepicker之前。

如果你有一个默认实例,就会发生这种情况,因为在jQuery插件中,它配置的默认日期是1899。

我们必须在此默认日期代码触发时找出原因

我用jsfiddle中的代码创建了一个演示,但我无法重现你的问题。 你能在http://jsfiddle.net/w78xX/查看吗?

我有同样的问题。 我用ajax填充datepicker字段,并在PrettyPhoto上显示它们作为弹出窗口。

这是我的代码。

 $( "body" ).on( "focus", ".tarih", function() { //$('.tarih').datepicker('destroy'); var i = 0; $('.tarih').each(function () { //$(this).attr("id",'date' + i).datepicker('destroy'); $(this).attr("id",'date' + i).datepicker({ dateFormat: "yy-mm-dd", firstDay: 1, minDate: new Date(2000, 1 - 1, 1) }); i++; }); }); 

尝试使用:格式:’mm / dd / yyyy hh:ii:ss P’诀窍是保持日期格式与后端返回的格式相同。

我有同样的问题,并添加useCurrent: false解决它。

 .datepicker({ useCurrent: false });