Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Since JavaScripts counts months starting from 0 (January is 0),
- //subtract 1 from the month integer submitted by the user
- var formattedMonth = userSubmittedMonth - 1;
- var testDate = new Date( userSubmittedYear,formattedMonth,userSubmittedDay,0,0,0,0) ;
- if (
- testDate.getFullYear() != userSubmittedYear
- || testDate.getMonth() != formattedMonth
- || testDate.getDate() != userSubmittedDay
- )
- {
- alert( "The date that you entered doesn't exist (like Feb. 31)" );
- }
Add Comment
Please, Sign In to add comment