Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checkDate() {
- //First if statement checks that day is within 1 and 31, the maximum and minumum amount of days in a month
- if (birthDay >= 1 && birthDay <= 31) {
- //Ensures that the entered day is possible for said month.
- if ( birthMonth == "January" || birthMonth == "March" || birthMonth == "May" || birthMonth == "July" || birthMonth== "August" || birthMonth == "October" || birthMonth== "December" && birthDay<=31 ) {
- validDate = 1;
- }
- if (birthMonth == "February" && birthDay<=29 ) {
- validDate = 1;
- }
- if (birthMonth == "April" && birthDay<=30 ) {
- validDate = 1;
- }
- } else {
- //If not a real day, valid date is set to zero
- validDate = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement