From: Iskren Chernev Date: Sun, 6 Aug 2017 23:31:22 +0000 (+0300) Subject: Do not use recursion, fixup #3875 X-Git-Tag: 2.19.0~33^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=475d4c1ca806f79adf46b6190f2505e83fd27ccb;p=thirdparty%2Fmoment.git Do not use recursion, fixup #3875 --- diff --git a/src/lib/units/month.js b/src/lib/units/month.js index 6f682f3f8..f504ed35e 100644 --- a/src/lib/units/month.js +++ b/src/lib/units/month.js @@ -21,10 +21,8 @@ export function daysInMonth(year, month) { return NaN; } var modMonth = mod(month, 12); - if (modMonth === month) { - return month === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - month % 7 % 2); - } - return daysInMonth(year + (month - modMonth) / 12, modMonth); + year += (month - modMonth) / 12; + return modMonth === 1 ? (isLeapYear(year) ? 29 : 28) : (31 - modMonth % 7 % 2); } // FORMATTING