Here is the solution:
var nowDate = new Date(2011, 12, 14).getTime(); var startDate = new Date(2011, 12, 13).getTime(); var endDate = new Date(2012, 1, 5).getTime(); if (startDate <= nowDate && nowDate <= endDate) { alert('It\'s in range!'); }
The "getTime()" method will create a timestamp from the created date. It's like a date in a number format wich can be easily compared to eachother.
Hi,
ReplyDeleteSilly question, but shouldn't the month be in the range 0-11?
John