Not sure if there's a better way?
/* var from is a date in string format "10/30/2010 03:44:12" */
var timeFrom = new Date(from);
var fromMonth = from.substring(0,2) - 0;
var fromDay = from.substring(3,5) - 0;
var fromYear = from.substring(6,10) - 0;
if (timeFrom.getMonth()+1 != fromMonth || timeFrom.getDate() != fromDay || timeFrom.getFullYear() != fromYear) {
$("div#error").text('Please enter a valid date range.');
}
Comments
Leave comment
Trackback