gdalldan
09-13-2010, 03:45 PM
I have a problem checking that a date is in the past or future.
Everything seems fine but the alert always comes back saying the date is in the past.
function OpenTimesheet(TSdate)
{
var SelectedDate = new Date(TSdate)
if (SelectedDate > Date())
{
alert (SelectedDate+' is a AFTER '+Date())
}
else
{
alert (SelectedDate+' is a BEFORE '+Date())
}
}
TSdate is in yyyy/mm/dd format and looks fine, in both alerts the dates are written correctly, it just always says they are a 'BEFORE' date regardless.
Any help with this one would be greatly apprieciated.
Everything seems fine but the alert always comes back saying the date is in the past.
function OpenTimesheet(TSdate)
{
var SelectedDate = new Date(TSdate)
if (SelectedDate > Date())
{
alert (SelectedDate+' is a AFTER '+Date())
}
else
{
alert (SelectedDate+' is a BEFORE '+Date())
}
}
TSdate is in yyyy/mm/dd format and looks fine, in both alerts the dates are written correctly, it just always says they are a 'BEFORE' date regardless.
Any help with this one would be greatly apprieciated.