JSFiddle - React, Tailwind, and code Playground
by Esther Mun
JavaScript
var todaysDate = new Date();
var date = new Date(2013,0,29);
var myBirthday = new Date (1990,11,15);
var todaysDate = new Date();
var date = new Date(2013,0,29);
var myBirthday = new Date (1990,11,15);
var isItSoEunsBirthday = function (){
if (date.getMonth() == myBirthday.getMonth() && date.getDate() == myBirthday.getDate()){
alert ("These two dates match! Happy birthday!");
}else{
var isTodaySoEunsBirthday = function (){
if (todaysDate.getMonth() == myBirthday.getMonth() && todaysDate.getDate() == myBirthday.getDate()){
alert("Yay! Today is your birthday! Happy birthday!");
} else {
alert("Sorry, Today is not your birthday!");
}
}
}
}
for(var isItSoEunsBirthday = new Date(); !(isItSoEunsBirthday.getDate() == myBirthday.getDate() && isItSoEunsBirthday.getMonth() == myBirthday.getMonth()); isItSoEunsBirthday.setDate(isItSoEunsBirthday.getDate() + 1) ) {
alert("Happy birthday! " + isItSoEunsBirthday.toString() + " is your birthday!");
}