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]);
精彩评论