I want to convert a date string to a date object in jQuery, and the code below works fine for Chrome and Firefox, but not in Internet Explorer:
<script type="text/javascript" charset="utf-8">
//Validate if the followup date is now or passed:
jQuery.noConflict();
var now = new Date();
jQuery(".FollowUpDate").each(function () {
if (jQuery(this).text().trim() != "") {
var followupDate = new Date(jQuery(this).text().trim()); //Here's the problem
alert(followupDate);
if (followupDate <= now) {
jQuery(this).removeClass('current');
jQuery(this).addClass('late');
}
else {
jQuery(this).removeClass('late');
jQuery(this).addClass('current');
}
}
});
</script>
The alert is only there for testing, and in Chrome and Firefox it returns a date object, but in IE I get NaN.
What's wrong, and how can I do this conversion so that it works in IE as well?