开发者

jQuery datepicker date range throwing invalid date range error with valid dates

For some reason when i enter the following dates into the following fields it is returning an invalid date range and i am not sure why:

http://jsfiddle.net/mQRaj/3/

To replicate please enter the following in the 'From' date:

30/11/200开发者_C百科9

and then this in the 'To' date:

7/9/2010

Bur if i enter 16/11/2009 and 7/9/2010 it does not throw an error and i am not sure what i am doing wrong.

Any explanation as to what i have done wrong?


This is because javascript uses American formatting for dates, also 16/11/2009 doesnt work when I try it?

you will need to split the string (UK date formatting) by '/' and then put it into the correct formatting.

Like so:

var dateParts = from.split('/');

var newDate = new Date(dateParts[1] + "/" + dateParts[0] + "/" + dateParts[2]);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜