admin管理员组文章数量:1435859
I am using the jquery datetimepicker and set it up as follows
$('.fddatetimepicker').datetimepicker({
dateFormat: 'dd/mm/yy'
});
No date is set by default. When I increment either of the hour or minute sliders for the first time by one place, I get the correct time but the date is set to 31/12/1899 in the input textbox. When i move the slider again it changes to the current date which is what I want.
Does anyone know why the initial increment of the slider causes the date to be 31/12/1899?
I also see this behaviour if i click anywhere on the slider for the first time and then the correct date is displayed when I click on the sliders any further times.
I am using the jquery datetimepicker and set it up as follows
$('.fddatetimepicker').datetimepicker({
dateFormat: 'dd/mm/yy'
});
No date is set by default. When I increment either of the hour or minute sliders for the first time by one place, I get the correct time but the date is set to 31/12/1899 in the input textbox. When i move the slider again it changes to the current date which is what I want.
Does anyone know why the initial increment of the slider causes the date to be 31/12/1899?
I also see this behaviour if i click anywhere on the slider for the first time and then the correct date is displayed when I click on the sliders any further times.
Share Improve this question asked May 7, 2015 at 14:49 Macca18Macca18 812 silver badges6 bronze badges 2- Might be this issue: stackoverflow./questions/21964112/… – Cody Commented May 7, 2015 at 14:55
- Have used some jQuery to ensure any 1899 date is replaced with current date – Macca18 Commented May 11, 2015 at 14:08
3 Answers
Reset to default 4just change the format of datetimepicker by using the below code. It will work like a charm. I had the same issue and I fixed using that approach below code.
$('.datetimepicker').datetimepicker({
format: "dd-mm-yyyy hh:ii:00P",
autoclose: true
});
You can use the "startDate: new Date" property to start on the current date.
Example:
$('.fddatetimepicker').datetimepicker({
dateFormat: 'dd/mm/yy',
startDate: new Date
});
More options and properties in: http://xdsoft/jqplugins/datetimepicker/
Try using format: 'mm/dd/yyyy hh:ii:ss P' The trick is to make sure your date format is the same as what the back-end returns.
本文标签: javascriptjQuery datetimepicker input text showing date 31121899 when time selectedStack Overflow
版权声明:本文标题:javascript - jQuery datetimepicker input text showing date 31121899 when time selected - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745617451a2666486.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论