Date.js
authorAlan <alan@roojs.com>
Wed, 15 Dec 2021 08:45:36 +0000 (16:45 +0800)
committerAlan <alan@roojs.com>
Wed, 15 Dec 2021 08:45:36 +0000 (16:45 +0800)
Date.js

diff --git a/Date.js b/Date.js
index 6f217a5..687a8ae 100644 (file)
--- a/Date.js
+++ b/Date.js
@@ -371,7 +371,7 @@ Date.formatCodeToRegex = function(character, currentGroup) {
             s:"(\\d{1,2})"}; // Numeric representation of a month, without leading zeros
     case "m":
         return {g:1,
-            c:"m = parseInt(results[" + currentGroup + "], 10) - 1;\n",
+            c:"m = Math.max(0,parseInt(results[" + currentGroup + "], 10) - 1);\n",
             s:"(\\d{2})"}; // Numeric representation of a month, with leading zeros
     case "t":
         return {g:0,