Browse Source

update date-extension

Robin Herbots 11 years ago
parent
commit
6e7bd492f1

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
 {
     "name": "jquery.inputmask",
     "name": "jquery.inputmask",
-    "version": "3.0.1",
+    "version": "3.0.2",
     "main": "./dist/jquery.inputmask.bundle.js",
     "main": "./dist/jquery.inputmask.bundle.js",
 	"keywords" : ["jQuery", "plugins", "input", "form", "inputmask", "mask"],
 	"keywords" : ["jQuery", "plugins", "input", "form", "inputmask", "mask"],
 	"description": "jquery.inputmask is a jquery plugin which create an input mask.",
 	"description": "jquery.inputmask is a jquery plugin which create an input mask.",

+ 1 - 1
build.properties

@@ -7,7 +7,7 @@ distdir = dist
 
 
 build.major = 3
 build.major = 3
 build.minor = 0
 build.minor = 0
-build.revision = 1
+build.revision = 2
 
 
 target = jquery.inputmask.bundle.js
 target = jquery.inputmask.bundle.js
 target.min = jquery.inputmask.bundle.min.js
 target.min = jquery.inputmask.bundle.min.js

BIN
dist/jQuery.InputMask.3.0.1.nupkg


BIN
dist/jQuery.InputMask.3.0.2.nupkg


+ 11 - 12
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * http://github.com/RobinHerbots/jquery.inputmask
 * http://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2014 Robin Herbots
 * Copyright (c) 2010 - 2014 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.0.1
+* Version: 3.0.2
 */
 */
 
 
 (function ($) {
 (function ($) {
@@ -519,9 +519,8 @@
                                     refreshFromBuffer(refresh["start"], refresh["end"]);
                                     refreshFromBuffer(refresh["start"], refresh["end"]);
                                 }
                                 }
                             } else if (rslt !== true && rslt["pos"] != position) { //their is a position offset
                             } else if (rslt !== true && rslt["pos"] != position) { //their is a position offset
-                                setValidPosition(position, $.extend({}, tst, { "input": casing(buffer[position], test) }), strict);
                                 validatedPos = rslt["pos"];
                                 validatedPos = rslt["pos"];
-                                refreshFromBuffer(position + 1, validatedPos);
+                                refreshFromBuffer(position, validatedPos);
                                 tst = getTests(validatedPos, !strict)[0]; //possible mismatch TODO
                                 tst = getTests(validatedPos, !strict)[0]; //possible mismatch TODO
                             }
                             }
                             if (ndx > 0) {
                             if (ndx > 0) {
@@ -1807,7 +1806,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 3.0.1
+Version: 3.0.2
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -1917,7 +1916,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 3.0.1
+Version: 3.0.2
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2005,7 +2004,7 @@ Optional extensions on the jquery.inputmask base
                                 isValid = opts.regex.val1.test("0" + chrs.charAt(0));
                                 isValid = opts.regex.val1.test("0" + chrs.charAt(0));
                                 if (isValid) {
                                 if (isValid) {
                                     buffer[pos - 1] = "0";
                                     buffer[pos - 1] = "0";
-                                    return { "pos": pos, "c": chrs.charAt(0) };
+                                    return { "refreshFromBuffer": { start: pos - 1, end: pos }, "pos": pos, "c": chrs.charAt(0) };
                                 }
                                 }
                             }
                             }
                         }
                         }
@@ -2037,7 +2036,7 @@ Optional extensions on the jquery.inputmask base
                                 isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0));
                                 isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0));
                                 if (isValid) {
                                 if (isValid) {
                                     buffer[pos - 1] = "0";
                                     buffer[pos - 1] = "0";
-                                    return { "pos": pos, "c": chrs.charAt(0) };
+                                    return { "refreshFromBuffer": { start: pos - 1, end: pos }, "pos": pos, "c": chrs.charAt(0) };
                                 }
                                 }
                             }
                             }
                         }
                         }
@@ -2137,7 +2136,7 @@ Optional extensions on the jquery.inputmask base
                                 buffer[pos - 1] = yearPrefix[0];
                                 buffer[pos - 1] = yearPrefix[0];
                                 buffer[pos++] = yearPrefix[1];
                                 buffer[pos++] = yearPrefix[1];
                                 buffer[pos++] = chrs[0];
                                 buffer[pos++] = chrs[0];
-                                return { "pos": pos };
+                                return { "refreshFromBuffer": { start: pos - 3, end: pos }, "pos": pos };
                             }
                             }
                         }
                         }
                         return isValid;
                         return isValid;
@@ -2195,7 +2194,7 @@ Optional extensions on the jquery.inputmask base
                                 isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0));
                                 isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0));
                                 if (isValid) {
                                 if (isValid) {
                                     buffer[pos - 1] = "0";
                                     buffer[pos - 1] = "0";
-                                    return { "pos": pos, "c": chrs.charAt(0) };
+                                    return { "refreshFromBuffer": { start: pos - 1, end: pos }, "pos": pos, "c": chrs.charAt(0) };
                                 }
                                 }
                             }
                             }
                         }
                         }
@@ -2414,7 +2413,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 3.0.1
+Version: 3.0.2
 
 
 Optional extensions on the jquery.inputmask base
 Optional extensions on the jquery.inputmask base
 */
 */
@@ -2581,7 +2580,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 3.0.1
+Version: 3.0.2
 
 
 Regex extensions on the jquery.inputmask base
 Regex extensions on the jquery.inputmask base
 Allows for using regular expressions as a mask
 Allows for using regular expressions as a mask
@@ -2768,7 +2767,7 @@ Input Mask plugin extensions
 http://github.com/RobinHerbots/jquery.inputmask
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-Version: 3.0.1
+Version: 3.0.2
 
 
 Phone extension.
 Phone extension.
 When using this extension make sure you specify the correct url to get the masks
 When using this extension make sure you specify the correct url to get the masks

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


File diff suppressed because it is too large
+ 14 - 13
dist/min/jquery.inputmask.date.extensions.js


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


+ 1 - 1
jquery.inputmask.jquery.json

@@ -8,7 +8,7 @@
 		"inputmask",
 		"inputmask",
 		"mask"
 		"mask"
     ],
     ],
-    "version": "3.0.1",
+    "version": "3.0.2",
     "author": {
     "author": {
         "name": "Robin Herbots",
         "name": "Robin Herbots",
         "url": "http://github.com/RobinHerbots/jquery.inputmask"
         "url": "http://github.com/RobinHerbots/jquery.inputmask"

+ 4 - 4
js/jquery.inputmask.date.extensions.js

@@ -91,7 +91,7 @@ Optional extensions on the jquery.inputmask base
                                 isValid = opts.regex.val1.test("0" + chrs.charAt(0));
                                 isValid = opts.regex.val1.test("0" + chrs.charAt(0));
                                 if (isValid) {
                                 if (isValid) {
                                     buffer[pos - 1] = "0";
                                     buffer[pos - 1] = "0";
-                                    return { "pos": pos, "c": chrs.charAt(0) };
+                                    return { "refreshFromBuffer": { start: pos - 1, end: pos }, "pos": pos, "c": chrs.charAt(0) };
                                 }
                                 }
                             }
                             }
                         }
                         }
@@ -123,7 +123,7 @@ Optional extensions on the jquery.inputmask base
                                 isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0));
                                 isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0));
                                 if (isValid) {
                                 if (isValid) {
                                     buffer[pos - 1] = "0";
                                     buffer[pos - 1] = "0";
-                                    return { "pos": pos, "c": chrs.charAt(0) };
+                                    return { "refreshFromBuffer": { start: pos - 1, end: pos }, "pos": pos, "c": chrs.charAt(0) };
                                 }
                                 }
                             }
                             }
                         }
                         }
@@ -223,7 +223,7 @@ Optional extensions on the jquery.inputmask base
                                 buffer[pos - 1] = yearPrefix[0];
                                 buffer[pos - 1] = yearPrefix[0];
                                 buffer[pos++] = yearPrefix[1];
                                 buffer[pos++] = yearPrefix[1];
                                 buffer[pos++] = chrs[0];
                                 buffer[pos++] = chrs[0];
-                                return { "pos": pos };
+                                return { "refreshFromBuffer": { start: pos - 3, end: pos }, "pos": pos };
                             }
                             }
                         }
                         }
                         return isValid;
                         return isValid;
@@ -281,7 +281,7 @@ Optional extensions on the jquery.inputmask base
                                 isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0));
                                 isValid = opts.regex.val2(opts.separator).test(frontValue + "0" + chrs.charAt(0));
                                 if (isValid) {
                                 if (isValid) {
                                     buffer[pos - 1] = "0";
                                     buffer[pos - 1] = "0";
-                                    return { "pos": pos, "c": chrs.charAt(0) };
+                                    return { "refreshFromBuffer": { start: pos - 1, end: pos }, "pos": pos, "c": chrs.charAt(0) };
                                 }
                                 }
                             }
                             }
                         }
                         }

+ 1 - 2
js/jquery.inputmask.js

@@ -519,9 +519,8 @@
                                     refreshFromBuffer(refresh["start"], refresh["end"]);
                                     refreshFromBuffer(refresh["start"], refresh["end"]);
                                 }
                                 }
                             } else if (rslt !== true && rslt["pos"] != position) { //their is a position offset
                             } else if (rslt !== true && rslt["pos"] != position) { //their is a position offset
-                                setValidPosition(position, $.extend({}, tst, { "input": casing(buffer[position], test) }), strict);
                                 validatedPos = rslt["pos"];
                                 validatedPos = rslt["pos"];
-                                refreshFromBuffer(position + 1, validatedPos);
+                                refreshFromBuffer(position, validatedPos);
                                 tst = getTests(validatedPos, !strict)[0]; //possible mismatch TODO
                                 tst = getTests(validatedPos, !strict)[0]; //possible mismatch TODO
                             }
                             }
                             if (ndx > 0) {
                             if (ndx > 0) {

+ 13 - 0
qunit/tests.js

@@ -1073,6 +1073,19 @@ test("inputmask(\"dd/mm/yyyy\") - input 23373 ", function () {
     $("#testmask").remove();
     $("#testmask").remove();
 });
 });
 
 
+test("inputmask(\"dd/mm/yyyy\") - input 23318 - jimithing277", function () {
+    var $fixture = $("#qunit-fixture");
+    $fixture.append('<input type="text" id="testmask" />');
+    $("#testmask").inputmask("dd/mm/yyyy");
+
+    $("#testmask")[0].focus();
+
+    $("#testmask").Type("23318");
+    equal($("#testmask").val(), "23/03/2018", "Result " + $("#testmask").val());
+
+    $("#testmask").remove();
+});
+
 test("inputmask(\"dd/mm/yyyy\", { yearrange: { minyear: 1900, maxyear: 2000 } }) - input 23373 ", function () {
 test("inputmask(\"dd/mm/yyyy\", { yearrange: { minyear: 1900, maxyear: 2000 } }) - input 23373 ", function () {
     var $fixture = $("#qunit-fixture");
     var $fixture = $("#qunit-fixture");
     $fixture.append('<input type="text" id="testmask" />');
     $fixture.append('<input type="text" id="testmask" />');