]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Do not use recursion, fixup #3875
authorIskren Chernev <iskren.chernev@gmail.com>
Sun, 6 Aug 2017 23:31:22 +0000 (02:31 +0300)
committerIskren Chernev <iskren.chernev@gmail.com>
Sun, 6 Aug 2017 23:31:22 +0000 (02:31 +0300)
src/lib/units/month.js

index 6f682f3f8e9bee71927a6dd8a5da4a4294334535..f504ed35e233e9851ec768866305506839094f1d 100644 (file)
@@ -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