var currenttime = '<!--#config timefmt="%a %b %d %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' var currenttime = currenttime+' GMT-0400 (EDT)'; var disableDate = new Date(); disableDate.setFullYear(2011,9,18); disableDate.setHours(17,0,0,0); if(disableDate < currenttime) $('#date_field').attr("disabled", true);
You're evaluating a string to some date. Convert your
currenttime string right into a Date object first:
var currenttime = '<!--#config timefmt="%a %b %d %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" --> GMT-0400 (EDT)'; currenttime = new Date(currenttime);
What you need to concentrate on is "how do i deny processing this type at some point?Inch—and as you can tell, the question doesn't rely on user clocks anymore. Go server-side!