Validate two date coming in the format YYYY-MM-DD coming through PopUP-Calendar

i m trying to validate two date coming in the format ‘YYYY-MM-DD’ coming through PopUP-Calendar in two textboxes(From date and To Date), If i select a date from “From date” Then in to date i must select date >= From date.

Plz help me.

There’s a lot of handwaving that goes on here, but you should be able to simply create two Date objects and compare them:


// these are just examples
var from = '2012-02-01',
    to = '2012-02-03';

from = new Date(from);
to = new Date(to);

alert(to >= from); // alerts "true"