Q:

check if the given date(in string format) has past present date using JS

I have a date range like 12/20/12-12/24/12(start date-end date) in string format .
I need to check if start date has past the present date. Can it be done using JS or j-query?
the date range is in string ?

A:

Use the power of the Date object!
var myString = "12/20/2012-12/24/2012",
    parts = myString.split("-");
if (Date.parse(parts[0]) < Date.now()) {
    alert("start date has past the present date");
}

You could as well write new Date(parts[0]) < new Date.

