IE JavaScript date parsing error

后端 未结 6 1694
南方客
南方客 2020-11-28 15:02

Why cannot IE parse this string as a Date object.

var d = Date.parse(\"Fri Jun 11 04:55:12 +0000 2010\"); // returns NaN

However, it works

6条回答
  •  星月不相逢
    2020-11-28 15:56

    I've found the jQuery Globalization Plugin date parsing to work best. Other methods had cross-browser issues and stuff like date.js had not been updated in quite a while.

    You also don't need a datePicker on the page. You can just call something similar to the example given in the docs:

    $.datepicker.parseDate('yy-mm-dd', '2007-01-26');
    

提交回复
热议问题