Getting the date object to work in IE6 (w/ YYYY-MM-DD param)?
Posted
by J. LaRosee
on Stack Overflow
See other posts from Stack Overflow
or by J. LaRosee
Published on 2010-06-09T00:52:44Z
Indexed on
2010/06/09
1:02 UTC
Read the original article
Hit count: 246
I just got IE6 sprung on me for a project that is going out into the wild soon, which means it's time to go back and comb through all of the CSS and JS. I've gotten hung up on the date object, however:
$.validator.addMethod("dateRange", function() {
var today = new Date();
var event_date_raw = $('#event_date').val();
var event_date_parts = event_date_raw.split("-");
var event_date = new Date( event_date_parts[2]+","+event_date_parts[1]+","+event_date_parts[0] );
if( event_date.getTime() >= today.getTime() )
return true;
return false;
}, "Please specify a correct date:");
event_date.getTime() is returning "NaN" in IE6 so the validation fails. The event_raw_date is in the YYYY-MM-DD format, which date doesn't seem to mind in every other browser...
Thoughts?
© Stack Overflow or respective owner