Browse Source

Issue with leapday #2546

Robin Herbots 4 years ago
parent
commit
962bc9c3bc

+ 1 - 0
CHANGELOG.md

@@ -16,6 +16,7 @@
 - clear masktemplate before submitting regardsless of the clearMaskOnLostFocus option
 
 ### Fixed
+- Issue with leapday #2546
 - Not removing the decimal separator in suffixed inputs #2511
 - Cant type dot on iphone #2541
 - How can I replace the dot for comma while tipping? #2542

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "5.0.7-beta.21",
+  "version": "5.0.7-beta.23",
   "main": [
 	  "./index.js",
     "./css/inputmask.css"

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/inputmask",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-  "version": "5.0.7-beta.21",
+  "version": "5.0.7-beta.23",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/Inputmask",

+ 62 - 62
dist/inputmask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2021 Robin Herbots
  * Licensed under the MIT license
- * Version: 5.0.7-beta.21
+ * Version: 5.0.7-beta.23
  */
 !function(e, t) {
     if ("object" == typeof exports && "object" == typeof module) module.exports = t(); else if ("function" == typeof define && define.amd) define([], t); else {
@@ -689,13 +689,13 @@
                     }, {
                         key: "setValue",
                         value: function(e, t, i, a, n) {
-                            if (void 0 !== t && (e[a] = "ampm" === a ? t : t.replace(/[^0-9]/g, "0"), e["raw" + a] = t), 
+                            if (void 0 !== t && (e[a] = "ampm" === a ? t : t.replace(/[^0-9]/g, "0"), e["raw" + a] = t.replace(/\s/g, "_")), 
                             void 0 !== n) {
                                 var r = e[a];
                                 ("day" === a && 29 === parseInt(r) || "month" === a && 2 === parseInt(r)) && (29 !== parseInt(e.day) || 2 !== parseInt(e.month) || "" !== e.year && void 0 !== e.year || e._date.setFullYear(2012, 1, 29)), 
                                 "day" === a && (v = !0, 0 === parseInt(r) && (r = 1)), "month" === a && (v = !0), 
-                                "year" === a && (v = !0, e.yearSet = t != i, r.length < 4 && (r = E(r, 4, !0))), 
-                                "" === r || isNaN(r) || n.call(e._date, r), "ampm" === a && n.call(e._date, r);
+                                "year" === a && (v = !0, r.length < 4 && (r = E(r, 4, !0))), "" === r || isNaN(r) || n.call(e._date, r), 
+                                "ampm" === a && n.call(e._date, r);
                             }
                         }
                     }, {
@@ -810,7 +810,7 @@
                 }
                 function x(e, t, i) {
                     if (!v) return !0;
-                    if (void 0 === e.rawday || !isFinite(e.rawday) && new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day || "29" == e.day && !Number.isFinite(e.rawyear) || new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day) return t;
+                    if (void 0 === e.rawday || !isFinite(e.rawday) && new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day || "29" == e.day && (!isFinite(e.rawyear) || void 0 === e.rawyear || "" === e.rawyear) || new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day) return t;
                     if ("29" == e.day) {
                         var a = w(t.pos, i);
                         if ("yyyy" === a.targetMatch[0] && t.pos - a.targetMatchIndex == 2) return t.remove = t.pos + 1, 
@@ -847,10 +847,10 @@
                     for (e = String(e), t = t || 2; e.length < t; ) e = i ? e + "0" : "0" + e;
                     return e;
                 }
-                function S(e, t, i) {
+                function _(e, t, i) {
                     return "string" == typeof e ? new d(e, t, i) : e && "object" === l(e) && Object.prototype.hasOwnProperty.call(e, "date") ? e : void 0;
                 }
-                function _(e, t) {
+                function S(e, t) {
                     return P(t.inputFormat, {
                         date: e
                     }, t);
@@ -876,7 +876,7 @@
                             return e.numericInput = !1, h.S = e.i18n.ordinalSuffix.join("|"), e.inputFormat = m[e.inputFormat] || e.inputFormat, 
                             e.displayFormat = m[e.displayFormat] || e.displayFormat || e.inputFormat, e.outputFormat = m[e.outputFormat] || e.outputFormat || e.inputFormat, 
                             e.placeholder = "" !== e.placeholder ? e.placeholder : e.inputFormat.replace(/[[\]]/, ""), 
-                            e.regex = P(e.inputFormat, void 0, e), e.min = S(e.min, e.inputFormat, e), e.max = S(e.max, e.inputFormat, e), 
+                            e.regex = P(e.inputFormat, void 0, e), e.min = _(e.min, e.inputFormat, e), e.max = _(e.max, e.inputFormat, e), 
                             null;
                         },
                         placeholder: "",
@@ -930,7 +930,7 @@
                                 "year" == f[2]) for (var v = s.getMaskTemplate.call(this, !1, 1, void 0, !0), m = t + 1; m < e.length; m++) e[m] = v[m], 
                                 delete r.validPositions[m];
                             }
-                            var g = a, k = S(e.join(""), n.inputFormat, n);
+                            var g = a, k = _(e.join(""), n.inputFormat, n);
                             return g && k.date.getTime() == k.date.getTime() && (n.prefillYear && (g = function(e, t, i) {
                                 if (e.year !== e.rawyear) {
                                     var a = p.toString(), n = e.rawyear.replace(/[^0-9]/g, ""), r = a.slice(0, n.length), o = a.slice(n.length);
@@ -974,17 +974,17 @@
                             } : g;
                         },
                         onKeyDown: function(e, t, i, a) {
-                            e.ctrlKey && e.keyCode === n.default.RIGHT && (this.inputmask._valueSet(_(new Date, a)), 
+                            e.ctrlKey && e.keyCode === n.default.RIGHT && (this.inputmask._valueSet(S(new Date, a)), 
                             f(this).trigger("setvalue"));
                         },
                         onUnMask: function(e, t, i) {
-                            return t ? P(i.outputFormat, S(e, i.inputFormat, i), i, !0) : t;
+                            return t ? P(i.outputFormat, _(e, i.inputFormat, i), i, !0) : t;
                         },
                         casing: function(e, t, i, a) {
                             return 0 == t.nativeDef.indexOf("[ap]") ? e.toLowerCase() : 0 == t.nativeDef.indexOf("[AP]") ? e.toUpperCase() : e;
                         },
                         onBeforeMask: function(e, t) {
-                            return "[object Date]" === Object.prototype.toString.call(e) && (e = _(e, t)), e;
+                            return "[object Date]" === Object.prototype.toString.call(e) && (e = S(e, t)), e;
                         },
                         insertMode: !1,
                         shiftPositions: !1,
@@ -1554,11 +1554,11 @@
                         }
                     })), y.length > 0) {
                         var x, P, E = o.seekNext.call(l, -1, void 0, !1);
-                        if (!s.isComplete.call(l, o.getBuffer.call(l)) && y.length <= E || s.isComplete.call(l, o.getBuffer.call(l)) && y.length > 0 && y.length !== E && 0 === y[0]) for (var S = E; void 0 !== (x = y.shift()); ) {
-                            var _ = new d.Event("_checkval");
-                            if ((P = c.validPositions[x]).generatedInput = !0, _.keyCode = P.input.charCodeAt(0), 
-                            (g = u.EventHandlers.keypressEvent.call(l, _, !0, !1, i, S)) && void 0 !== g.pos && g.pos !== x && c.validPositions[g.pos] && !0 === c.validPositions[g.pos].match.static) y.push(g.pos); else if (!g) break;
-                            S++;
+                        if (!s.isComplete.call(l, o.getBuffer.call(l)) && y.length <= E || s.isComplete.call(l, o.getBuffer.call(l)) && y.length > 0 && y.length !== E && 0 === y[0]) for (var _ = E; void 0 !== (x = y.shift()); ) {
+                            var S = new d.Event("_checkval");
+                            if ((P = c.validPositions[x]).generatedInput = !0, S.keyCode = P.input.charCodeAt(0), 
+                            (g = u.EventHandlers.keypressEvent.call(l, S, !0, !1, i, _)) && void 0 !== g.pos && g.pos !== x && c.validPositions[g.pos] && !0 === c.validPositions[g.pos].match.static) y.push(g.pos); else if (!g) break;
+                            _++;
                         }
                     }
                     t && p.call(l, e, o.getBuffer.call(l), g ? g.forwardPosition : l.caretPos.begin, n || new d.Event("checkval"), n && ("input" === n.type || "paste" === n.type) && l.undoValue !== l._valueGet(!0)), 
@@ -2043,8 +2043,8 @@
                             break;
 
                           case i.quantifiermarker[0]:
-                            var S = new n.default(!1, !1, !0), _ = (o = o.replace(/[{}?]/g, "")).split("|"), w = _[0].split(","), M = isNaN(w[0]) ? w[0] : parseInt(w[0]), O = 1 === w.length ? M : isNaN(w[1]) ? w[1] : parseInt(w[1]), T = isNaN(_[1]) ? _[1] : parseInt(_[1]);
-                            "*" !== M && "+" !== M || (M = "*" === O ? 0 : 1), S.quantifier = {
+                            var _ = new n.default(!1, !1, !0), S = (o = o.replace(/[{}?]/g, "")).split("|"), w = S[0].split(","), M = isNaN(w[0]) ? w[0] : parseInt(w[0]), O = 1 === w.length ? M : isNaN(w[1]) ? w[1] : parseInt(w[1]), T = isNaN(S[1]) ? S[1] : parseInt(S[1]);
+                            "*" !== M && "+" !== M || (M = "*" === O ? 0 : 1), _.quantifier = {
                                 min: M,
                                 max: O,
                                 jit: T
@@ -2055,7 +2055,7 @@
                                 var A = new n.default(!0), D = C.pop();
                                 C.push(A), C = A.matches, a = D;
                             }
-                            a.isGroup || (a = b([ a ])), C.push(a), C.push(S);
+                            a.isGroup || (a = b([ a ])), C.push(a), C.push(_);
                             break;
 
                           case i.alternatormarker:
@@ -2529,10 +2529,10 @@
                                         h = !0, d = e;
                                     }
                                 } else if (n.isAlternator) {
-                                    var E, S = n, _ = [], w = v.slice(), M = r.length, O = !1, T = i.length > 0 ? i.shift() : -1;
+                                    var E, _ = n, S = [], w = v.slice(), M = r.length, O = !1, T = i.length > 0 ? i.shift() : -1;
                                     if (-1 === T || "string" == typeof T) {
                                         var C, A = d, D = i.slice(), j = [];
-                                        if ("string" == typeof T) j = T.split(","); else for (C = 0; C < S.matches.length; C++) j.push(C.toString());
+                                        if ("string" == typeof T) j = T.split(","); else for (C = 0; C < _.matches.length; C++) j.push(C.toString());
                                         if (void 0 !== s.excludes[e]) {
                                             for (var B = j.slice(), R = 0, L = s.excludes[e].length; R < L; R++) {
                                                 var I = s.excludes[e][R].toString().split(":");
@@ -2543,21 +2543,21 @@
                                         (!0 === u.keepStatic || isFinite(parseInt(u.keepStatic)) && A >= u.keepStatic) && (j = j.slice(0, 1));
                                         for (var F = 0; F < j.length; F++) {
                                             C = parseInt(j[F]), v = [], i = "string" == typeof T && k(d, C, M) || D.slice();
-                                            var N = S.matches[C];
-                                            if (N && o(N, [ C ].concat(r), f)) n = !0; else if (0 === F && (O = !0), N && N.matches && N.matches.length > S.matches[0].matches.length) break;
+                                            var N = _.matches[C];
+                                            if (N && o(N, [ C ].concat(r), f)) n = !0; else if (0 === F && (O = !0), N && N.matches && N.matches.length > _.matches[0].matches.length) break;
                                             E = v.slice(), d = A, v = [];
                                             for (var V = 0; V < E.length; V++) {
                                                 var G = E[V], H = !1;
                                                 G.match.jit = G.match.jit || O, G.alternation = G.alternation || M, y(G);
-                                                for (var K = 0; K < _.length; K++) {
-                                                    var U = _[K];
+                                                for (var K = 0; K < S.length; K++) {
+                                                    var U = S[K];
                                                     if ("string" != typeof T || void 0 !== G.alternation && j.includes(G.locator[G.alternation].toString())) {
                                                         if (G.match.nativeDef === U.match.nativeDef) {
                                                             H = !0, y(U, G);
                                                             break;
                                                         }
                                                         if (l(G, U, u)) {
-                                                            y(G, U) && (H = !0, _.splice(_.indexOf(U), 0, G));
+                                                            y(G, U) && (H = !0, S.splice(S.indexOf(U), 0, G));
                                                             break;
                                                         }
                                                         if (l(U, G, u)) {
@@ -2565,16 +2565,16 @@
                                                             break;
                                                         }
                                                         if (Q = U, !0 === (W = G).match.static && !0 !== Q.match.static && Q.match.fn.test(W.match.def, s, e, !1, u, !1)) {
-                                                            b(G, U) || void 0 !== c.inputmask.userOptions.keepStatic ? y(G, U) && (H = !0, _.splice(_.indexOf(U), 0, G)) : u.keepStatic = !0;
+                                                            b(G, U) || void 0 !== c.inputmask.userOptions.keepStatic ? y(G, U) && (H = !0, S.splice(S.indexOf(U), 0, G)) : u.keepStatic = !0;
                                                             break;
                                                         }
                                                     }
                                                 }
-                                                H || _.push(G);
+                                                H || S.push(G);
                                             }
                                         }
-                                        v = w.concat(_), d = e, h = v.length > 0, n = _.length > 0, i = D.slice();
-                                    } else n = o(S.matches[T] || t.matches[T], [ T ].concat(r), f);
+                                        v = w.concat(S), d = e, h = v.length > 0, n = S.length > 0, i = D.slice();
+                                    } else n = o(_.matches[T] || t.matches[T], [ T ].concat(r), f);
                                     if (n) return !0;
                                 } else if (n.isQuantifier && f !== t.matches[t.matches.indexOf(n) - 1]) for (var $ = n, z = i.length > 0 ? i.shift() : 0; z < (isNaN($.quantifier.max) ? z + 1 : $.quantifier.max) && d <= e; z++) {
                                     var q = t.matches[t.matches.indexOf($) - 1];
@@ -2686,39 +2686,39 @@
                     default: a
                 }, o = i(8711), s = i(6030);
                 function l(e, t, i, a, r, s) {
-                    var u, c, d, p, v, h, m, g, k, y, b, x = this, P = this.dependencyLib, E = this.opts, S = x.maskset, _ = P.extend(!0, {}, S.validPositions), w = P.extend(!0, {}, S.tests), M = !1, O = !1, T = void 0 !== r ? r : o.getLastValidPosition.call(x);
+                    var u, c, d, p, v, h, m, g, k, y, b, x = this, P = this.dependencyLib, E = this.opts, _ = x.maskset, S = P.extend(!0, {}, _.validPositions), w = P.extend(!0, {}, _.tests), M = !1, O = !1, T = void 0 !== r ? r : o.getLastValidPosition.call(x);
                     if (s && (y = s.begin, b = s.end, s.begin > s.end && (y = s.end, b = s.begin)), 
-                    -1 === T && void 0 === r) u = 0, c = (p = n.getTest.call(x, u)).alternation; else for (;T >= 0; T--) if ((d = S.validPositions[T]) && void 0 !== d.alternation) {
+                    -1 === T && void 0 === r) u = 0, c = (p = n.getTest.call(x, u)).alternation; else for (;T >= 0; T--) if ((d = _.validPositions[T]) && void 0 !== d.alternation) {
                         if (p && p.locator[d.alternation] !== d.locator[d.alternation]) break;
-                        u = T, c = S.validPositions[u].alternation, p = d;
+                        u = T, c = _.validPositions[u].alternation, p = d;
                     }
                     if (void 0 !== c) {
-                        m = parseInt(u), S.excludes[m] = S.excludes[m] || [], !0 !== e && S.excludes[m].push((0, 
+                        m = parseInt(u), _.excludes[m] = _.excludes[m] || [], !0 !== e && _.excludes[m].push((0, 
                         n.getDecisionTaker)(p) + ":" + p.alternation);
                         var C = [], A = -1;
                         for (v = m; v < o.getLastValidPosition.call(x, void 0, !0) + 1; v++) -1 === A && e <= v && void 0 !== t && (C.push(t), 
-                        A = C.length - 1), (h = S.validPositions[v]) && !0 !== h.generatedInput && (void 0 === s || v < y || v >= b) && C.push(h.input), 
-                        delete S.validPositions[v];
-                        for (-1 === A && void 0 !== t && (C.push(t), A = C.length - 1); void 0 !== S.excludes[m] && S.excludes[m].length < 10; ) {
-                            for (S.tests = {}, o.resetMaskSet.call(x, !0), M = !0, v = 0; v < C.length && (g = M.caret || o.getLastValidPosition.call(x, void 0, !0) + 1, 
+                        A = C.length - 1), (h = _.validPositions[v]) && !0 !== h.generatedInput && (void 0 === s || v < y || v >= b) && C.push(h.input), 
+                        delete _.validPositions[v];
+                        for (-1 === A && void 0 !== t && (C.push(t), A = C.length - 1); void 0 !== _.excludes[m] && _.excludes[m].length < 10; ) {
+                            for (_.tests = {}, o.resetMaskSet.call(x, !0), M = !0, v = 0; v < C.length && (g = M.caret || o.getLastValidPosition.call(x, void 0, !0) + 1, 
                             k = C[v], M = f.call(x, g, k, !1, a, !0)); v++) v === A && (O = M), 1 == e && M && (O = {
                                 caretPos: v
                             });
                             if (M) break;
-                            if (o.resetMaskSet.call(x), p = n.getTest.call(x, m), S.validPositions = P.extend(!0, {}, _), 
-                            S.tests = P.extend(!0, {}, w), !S.excludes[m]) {
+                            if (o.resetMaskSet.call(x), p = n.getTest.call(x, m), _.validPositions = P.extend(!0, {}, S), 
+                            _.tests = P.extend(!0, {}, w), !_.excludes[m]) {
                                 O = l.call(x, e, t, i, a, m - 1, s);
                                 break;
                             }
                             var D = (0, n.getDecisionTaker)(p);
-                            if (-1 !== S.excludes[m].indexOf(D + ":" + p.alternation)) {
+                            if (-1 !== _.excludes[m].indexOf(D + ":" + p.alternation)) {
                                 O = l.call(x, e, t, i, a, m - 1, s);
                                 break;
                             }
-                            for (S.excludes[m].push(D + ":" + p.alternation), v = m; v < o.getLastValidPosition.call(x, void 0, !0) + 1; v++) delete S.validPositions[v];
+                            for (_.excludes[m].push(D + ":" + p.alternation), v = m; v < o.getLastValidPosition.call(x, void 0, !0) + 1; v++) delete _.validPositions[v];
                         }
                     }
-                    return O && !1 === E.keepStatic || delete S.excludes[m], O;
+                    return O && !1 === E.keepStatic || delete _.excludes[m], O;
                 }
                 function u(e, t, i) {
                     var a = this.opts, n = this.maskset;
@@ -2810,40 +2810,40 @@
                         })), s;
                     }
                     void 0 !== e.begin && (x = m.isRTL ? e.end : e.begin);
-                    var S = !0, _ = g.extend(!0, {}, y.validPositions);
+                    var _ = !0, S = g.extend(!0, {}, y.validPositions);
                     if (!1 === k.keepStatic && void 0 !== y.excludes[x] && !0 !== r && !0 !== a) for (var w = x; w < (m.isRTL ? e.begin : e.end); w++) void 0 !== y.excludes[w] && (y.excludes[w] = void 0, 
                     delete y.tests[w]);
-                    if ("function" == typeof k.preValidation && !0 !== a && !0 !== s && (S = P(S = k.preValidation.call(m, o.getBuffer.call(m), x, t, b(e), k, y, e, i || r))), 
-                    !0 === S) {
-                        if (S = E(x, t, i), (!i || !0 === a) && !1 === S && !0 !== s) {
+                    if ("function" == typeof k.preValidation && !0 !== a && !0 !== s && (_ = P(_ = k.preValidation.call(m, o.getBuffer.call(m), x, t, b(e), k, y, e, i || r))), 
+                    !0 === _) {
+                        if (_ = E(x, t, i), (!i || !0 === a) && !1 === _ && !0 !== s) {
                             var M = y.validPositions[x];
                             if (!M || !0 !== M.match.static || M.match.def !== t && t !== k.skipOptionalPartCharacter) {
                                 if (k.insertMode || void 0 === y.validPositions[o.seekNext.call(m, x)] || e.end > x) {
                                     var O = !1;
-                                    if (y.jitOffset[x] && void 0 === y.validPositions[o.seekNext.call(m, x)] && !1 !== (S = f.call(m, x + y.jitOffset[x], t, !0, !0)) && (!0 !== r && (S.caret = x), 
-                                    O = !0), e.end > x && (y.validPositions[x] = void 0), !O && !o.isMask.call(m, x, k.keepStatic && 0 === x)) for (var T = x + 1, C = o.seekNext.call(m, x, !1, 0 !== x); T <= C; T++) if (!1 !== (S = E(T, t, i))) {
-                                        S = v.call(m, x, void 0 !== S.pos ? S.pos : T) || S, x = T;
+                                    if (y.jitOffset[x] && void 0 === y.validPositions[o.seekNext.call(m, x)] && !1 !== (_ = f.call(m, x + y.jitOffset[x], t, !0, !0)) && (!0 !== r && (_.caret = x), 
+                                    O = !0), e.end > x && (y.validPositions[x] = void 0), !O && !o.isMask.call(m, x, k.keepStatic && 0 === x)) for (var T = x + 1, C = o.seekNext.call(m, x, !1, 0 !== x); T <= C; T++) if (!1 !== (_ = E(T, t, i))) {
+                                        _ = v.call(m, x, void 0 !== _.pos ? _.pos : T) || _, x = T;
                                         break;
                                     }
                                 }
-                            } else S = {
+                            } else _ = {
                                 caret: o.seekNext.call(m, x)
                             };
                         }
-                        !1 !== S || !k.keepStatic || !c.call(m, o.getBuffer.call(m)) && 0 !== x || i || !0 === r ? b(e) && y.tests[x] && y.tests[x].length > 1 && k.keepStatic && !i && !0 !== r && (S = l.call(m, !0)) : S = l.call(m, x, t, i, a, void 0, e), 
-                        !0 === S && (S = {
+                        !1 !== _ || !k.keepStatic || !c.call(m, o.getBuffer.call(m)) && 0 !== x || i || !0 === r ? b(e) && y.tests[x] && y.tests[x].length > 1 && k.keepStatic && !i && !0 !== r && (_ = l.call(m, !0)) : _ = l.call(m, x, t, i, a, void 0, e), 
+                        !0 === _ && (_ = {
                             pos: x
                         });
                     }
                     if ("function" == typeof k.postValidation && !0 !== a && !0 !== s) {
-                        var A = k.postValidation.call(m, o.getBuffer.call(m, !0), void 0 !== e.begin ? m.isRTL ? e.end : e.begin : e, t, S, k, y, i, d);
-                        void 0 !== A && (S = !0 === A ? S : A);
+                        var A = k.postValidation.call(m, o.getBuffer.call(m, !0), void 0 !== e.begin ? m.isRTL ? e.end : e.begin : e, t, _, k, y, i, d);
+                        void 0 !== A && (_ = !0 === A ? _ : A);
                     }
-                    S && void 0 === S.pos && (S.pos = x), !1 === S || !0 === s ? (o.resetMaskSet.call(m, !0), 
-                    y.validPositions = g.extend(!0, {}, _)) : v.call(m, void 0, x, !0);
-                    var D = P(S);
+                    _ && void 0 === _.pos && (_.pos = x), !1 === _ || !0 === s ? (o.resetMaskSet.call(m, !0), 
+                    y.validPositions = g.extend(!0, {}, S)) : v.call(m, void 0, x, !0);
+                    var D = P(_);
                     void 0 !== m.maxLength && (o.getBuffer.call(m).length > m.maxLength && !a && (o.resetMaskSet.call(m, !0), 
-                    y.validPositions = g.extend(!0, {}, _), D = !1));
+                    y.validPositions = g.extend(!0, {}, S), D = !1));
                     return D;
                 }
                 function d(e, t, i) {
@@ -2918,8 +2918,8 @@
                                 for (;"" !== n.getTest.call(r, E).match.def; ) {
                                     if (!1 !== (x = d.call(r, E, b, l)) || "+" === b.match.def) {
                                         "+" === b.match.def && o.getBuffer.call(r, !0);
-                                        var S = f.call(r, E, b.input, "+" !== b.match.def, !0);
-                                        if (m = !1 !== S, P = (S.pos || E) + 1, !m && x) break;
+                                        var _ = f.call(r, E, b.input, "+" !== b.match.def, !0);
+                                        if (m = !1 !== _, P = (_.pos || E) + 1, !m && x) break;
                                     } else m = !1;
                                     if (m) {
                                         void 0 === t && b.match.static && g === e.begin && p++;

File diff suppressed because it is too large
+ 2 - 2
dist/inputmask.min.js


+ 5 - 5
dist/jquery.inputmask.js

@@ -3,7 +3,7 @@
  * https://github.com/RobinHerbots/Inputmask
  * Copyright (c) 2010 - 2021 Robin Herbots
  * Licensed under the MIT license
- * Version: 5.0.7-beta.21
+ * Version: 5.0.7-beta.23
  */
 !function(e, t) {
     if ("object" == typeof exports && "object" == typeof module) module.exports = t(require("jquery")); else if ("function" == typeof define && define.amd) define([ "jquery" ], t); else {
@@ -563,13 +563,13 @@
                     }, {
                         key: "setValue",
                         value: function(e, t, i, a, n) {
-                            if (void 0 !== t && (e[a] = "ampm" === a ? t : t.replace(/[^0-9]/g, "0"), e["raw" + a] = t), 
+                            if (void 0 !== t && (e[a] = "ampm" === a ? t : t.replace(/[^0-9]/g, "0"), e["raw" + a] = t.replace(/\s/g, "_")), 
                             void 0 !== n) {
                                 var r = e[a];
                                 ("day" === a && 29 === parseInt(r) || "month" === a && 2 === parseInt(r)) && (29 !== parseInt(e.day) || 2 !== parseInt(e.month) || "" !== e.year && void 0 !== e.year || e._date.setFullYear(2012, 1, 29)), 
                                 "day" === a && (h = !0, 0 === parseInt(r) && (r = 1)), "month" === a && (h = !0), 
-                                "year" === a && (h = !0, e.yearSet = t != i, r.length < 4 && (r = E(r, 4, !0))), 
-                                "" === r || isNaN(r) || n.call(e._date, r), "ampm" === a && n.call(e._date, r);
+                                "year" === a && (h = !0, r.length < 4 && (r = E(r, 4, !0))), "" === r || isNaN(r) || n.call(e._date, r), 
+                                "ampm" === a && n.call(e._date, r);
                             }
                         }
                     }, {
@@ -684,7 +684,7 @@
                 }
                 function x(e, t, i) {
                     if (!h) return !0;
-                    if (void 0 === e.rawday || !isFinite(e.rawday) && new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day || "29" == e.day && !Number.isFinite(e.rawyear) || new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day) return t;
+                    if (void 0 === e.rawday || !isFinite(e.rawday) && new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day || "29" == e.day && (!isFinite(e.rawyear) || void 0 === e.rawyear || "" === e.rawyear) || new Date(e.date.getFullYear(), isFinite(e.rawmonth) ? e.month : e.date.getMonth() + 1, 0).getDate() >= e.day) return t;
                     if ("29" == e.day) {
                         var a = _(t.pos, i);
                         if ("yyyy" === a.targetMatch[0] && t.pos - a.targetMatchIndex == 2) return t.remove = t.pos + 1, 

File diff suppressed because it is too large
+ 2 - 2
dist/jquery.inputmask.min.js


+ 2 - 3
lib/extensions/inputmask.date.extensions.js

@@ -57,7 +57,7 @@ class DateObject {
 	setValue(dateObj, value, fcode, targetProp, dateOperation) {
 		if (value !== undefined) {
 			dateObj[targetProp] = targetProp === "ampm" ? value : value.replace(/[^0-9]/g, "0");
-			dateObj["raw" + targetProp] = value;
+			dateObj["raw" + targetProp] = value.replace(/\s/g, "_");
 		}
 		if (dateOperation !== undefined) {
 			let datavalue = dateObj[targetProp];
@@ -76,7 +76,6 @@ class DateObject {
 				useDateObject = true;
 			if (targetProp === "year") {
 				useDateObject = true;
-				dateObj["yearSet"] = value != fcode;
 				if (datavalue.length < 4)
 					datavalue = pad(datavalue, 4, true);
 			}
@@ -257,7 +256,7 @@ function isValidDate(dateParts, currentResult, opts) {
 	if (!useDateObject) return true;
 	if (dateParts.rawday === undefined
 		|| (!isFinite(dateParts.rawday) && new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day)
-		|| (dateParts.day == "29" && !Number.isFinite(dateParts.rawyear))
+		|| (dateParts.day == "29" && (!isFinite(dateParts.rawyear) || dateParts.rawyear === undefined || dateParts.rawyear === ""))
 		|| new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day) {
 		return currentResult;
 	} else { //take corrective action if possible

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "inputmask",
-  "version": "5.0.7-beta.21",
+  "version": "5.0.7-beta.23",
   "description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
   "main": "dist/inputmask.js",
   "files": [

+ 1 - 1
qunit/tests_date.js

@@ -1075,7 +1075,7 @@ export default function (qunit, Inputmask) {
 		assert.equal(testmask.value, "30/mm/yyyy", "Result " + testmask.value);
 	});
 
-	qunit.test("leapyear bug - when placeholder is defined to space cant type 2 after type 20/0 - #2451", function (assert) {
+	qunit.test("leapyear bug - when placeholder is defined to space cant type 2 after type 29/0 - #2451", function (assert) {
 		var $fixture = $("#qunit-fixture");
 		$fixture.append("<input type=\"text\" id=\"testmask\" />");
 		var testmask = document.getElementById("testmask");