Validation Error on Date field

The following method always gives me an error even though the departure date field is always entered as greater than the arrival date.

if ( tmpDepartureDate <= tmpArrivalDate
|| new Date(tmpDepartureDate - tmpArrivalDate).getDate() > 30 )
{
application.beep();
var res = plugins.dialogs.showDialog( ‘Error: invalid date’,
‘Departure date must be greater than arrival date (but lesser than one month).’, ‘OK’);

tmpDepartureDate = null;
}
enableButton();

Any thoughts here? TIA[/quote]

Michael, I have been playing with it.
I think this is not possible like this because it is calculating with milliseconds.
In fact you should use 302460601000 (dayshoursminutessecondsmilliseconds) but then again I can’t tell if this works.

I couldn’t see anything working other than (new Date(2004,3,25)-new Date(2004,3,20))/(30*24*60*60*1000). The result was 5. As soon as I did ```
(new Date(2004,3,25)-new Date(2004,3,20))/(302460601000)