Skip to content

Instantly share code, notes, and snippets.

@Nasah-Kuma
Created September 21, 2022 09:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nasah-Kuma/995174bf7de654d589b58bc518f7b05f to your computer and use it in GitHub Desktop.
Save Nasah-Kuma/995174bf7de654d589b58bc518f7b05f to your computer and use it in GitHub Desktop.
function dayOfProgrammer(year) {
// Write your code here
let feb = 0;
let initialDaySum = 0;
if (year >= 1700 && year <= 1917) {
if (year % 4 === 0) feb = 29;
else feb = 28;
}
else if (year > 1918 && year <= 2700) {
if (year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0)) feb = 29;
else feb = 28;
} else {
feb = 29 - 14;
}
initialDaySum = 31 + feb + 31 + 30 + 31 + 30 + 31 + 31;
let date = 256 - initialDaySum;
return `${date+'.' + '09' + '.' + year}`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment