javascript - cannot find amount of days until next birthday for the user input -
The quantity of days will be given below the birthday of the persons, if the birthday has already happened, you will give it on the first day when your Had a birthday
I'm still thinking the weather is possible to calculate the day till the next birthday, it will be required last December and will be calculated from January. I can not seem right about this.
// Birthday and form form of month Birth Birthday Mouth = Doc. GateAllmentBiID ('Cellont'). value; Var birthday day = document. GetElementById ('selDay'). Values; // parsing birthday and month of birthday = persian (birthday month); Birthday = day = (date of birthdate); // setting date object today = new date (); // set today's date birthdays = new date (); // Set up Birthday Object Birthday. SetMonth (Month of Birthday); // Set Birthday Birthday December Birthday Birthday (birthdays); // set birthday date on 15th day (if today's birthday) // // It gets to the next birthday - diff = Math.abs (Birthday .getTime () - today.getTime ()); Diff = Math.floor (diff / (1000 × 60 * 60 * 24)); Warning ('till your birthday' + 'diff +' days are;); } Else {// It has been day since last birthday - diff = Math.abs (today .gettime) - birthday .getTime ()); Diff = Math.floor (diff / (1000 × 60 * 60 * 24)); Warning ('this was your last birthday' since '+ diff +' day); }
try it
var birthdayMonth = document . .getElementById ('selMonth') value; Var birthday day = document. GetElementById ('selDay'). Values; Birthday = parse (birthday month); Birthday = day = (date of birthdate); Today = new date (); // set today's date birthdays = new date (); // Set birthday birthday birthday.SsetMonth (Month of Birthday -1); // Set Birthday Birthday December Birthday Birthday (birthdays); // Set Birthday Date on 15th If (today & lt; Birthday) {diff = Math.abs (birthday.getTime () - today.getTime ()); Diff = Math.floor (diff / (1000 × 60 * 60 * 24)); Be alert ('There are' + diff + 'days unless' + (birthday month) +' + birthday date); } And {warnings ("b-day has passed!"); }
Hope it's helpful!
Comments
Post a Comment