JSFiddle - React, Tailwind, and code Playground

by aprilkw

JavaScript

//var isItSoonasBirthday = new Date("December 24, 1900");
//var day = isItSoonasBirthday.getDate();
//alert(day);

//if (day < 2)
//{alert ("Today isn't Soona's Birthday");}
//alert ("Today is Soona's Birthday");

var today = new Date();

var myBirthday = new Date(1990, 1, 6);

function isItSoonasBirthday(date) {
    if (date.getMonth() == myBirthday.getMonth() && date.getDate() == myBirthday.getDate()) {
        return true;
    
    } else {
        return false;
    }
}

isItSoonasBirthday();

function isTodaySoonasBirthday() {
    if (today.getMonth() == myBirthday.getMonth() && today.getDate() == myBirthday.getDate()) {
        alert("Today is my Birthday! Happy Birthday!!");
    } else {
        return false;
    }
}