admin管理员组文章数量:1417411
What is the difference between
new Date(2013,0,1)
and
Date.parse("2013-1-1")
that breaks
Here is jsfiddle /
What is the difference between
new Date(2013,0,1)
and
Date.parse("2013-1-1")
that breaks http://api.jqueryui./datepicker/#method-setDate
Here is jsfiddle http://jsfiddle/tawVx/4/
Share Improve this question asked Nov 14, 2012 at 15:48 tomaszbaktomaszbak 8,2874 gold badges46 silver badges37 bronze badges 01 Answer
Reset to default 3Date.parse() returns the number of milliseconds elapsed since January 1st, 1970, 00:00:00 UTC, not a Date
object.
setDate() takes either a Date
object or a string, not a number of milliseconds elapsed since the epoch.
The following code would work:
$("#datepicker").datepicker("setDate", new Date(Date.parse("2013-01-01")));
本文标签: javascriptjQuery UI datepicker setDate with new Date vs DateparseStack Overflow
版权声明:本文标题:javascript - jQuery UI datepicker setDate with new Date vs Date.parse - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745266004a2650604.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论