From 96ec3038755a8b617d0378a03ff6833651b1638e Mon Sep 17 00:00:00 2001 From: Rak Laptudirm <68542775+raklaptudirm@users.noreply.github.com> Date: Thu, 21 Jan 2021 10:22:15 +0530 Subject: [PATCH] Updated if condition for Leap year detection --- Timing-Functions/GetMonthDays.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Timing-Functions/GetMonthDays.js b/Timing-Functions/GetMonthDays.js index fcf5604d3..9cfc35981 100644 --- a/Timing-Functions/GetMonthDays.js +++ b/Timing-Functions/GetMonthDays.js @@ -21,11 +21,7 @@ const getMonthDays = (monthNumber, year) => { if (the30DaysMonths.includes(monthNumber)) { return 30 } // Check for Leap year - if (year % 4 === 0) { - if ((year % 100 !== 0) || (year % 100 === 0 && year % 400 === 0)) { - return 29 - } - } + if (((year % 400) === 0)||(((year % 100) != 0) && ((year % 4) === 0))) { return 29 } return 28 }