I've build a function which checks if a date parts values are valid :
Bad value example :
new Date(2012,3,44) =
Mon May 14 2012 00:00:00 GMT+0300 (Jerusalem Daylight Time)
Here is the function ( its arguments are being sent by me separately
!)
function isDate(year, month, day)
{
...
}
alert(isDate( 2001,2,29));
However , I have a problem.
If I have an invalid date object like : var t= new Date(2001,2,44)
:
And I want to send it to my function , I need to extract its values.
How can I extract the 44
value + 2
value ?
t.getDate() //13
t.getMonth() //3 (days went from march to april)
any help ?