Browse Source

datetime unmasking final #1914

Robin Herbots 7 years ago
parent
commit
69092db580
47 changed files with 64 additions and 64 deletions
  1. 1 1
      bower.json
  2. 1 1
      component.json
  3. 1 1
      composer.json
  4. 1 1
      dist/inputmask/bindings/inputmask.binding.js
  5. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js
  6. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js
  7. 1 1
      dist/inputmask/dependencyLibs/inputmask.dependencyLib.js
  8. 1 1
      dist/inputmask/global/document.js
  9. 1 1
      dist/inputmask/global/window.js
  10. 4 4
      dist/inputmask/inputmask.date.extensions.js
  11. 1 1
      dist/inputmask/inputmask.extensions.js
  12. 1 1
      dist/inputmask/inputmask.js
  13. 1 1
      dist/inputmask/inputmask.numeric.extensions.js
  14. 1 1
      dist/inputmask/inputmask.phone.extensions.js
  15. 1 1
      dist/inputmask/jquery.inputmask.js
  16. 1 1
      dist/inputmask/phone-codes/phone-be.js
  17. 1 1
      dist/inputmask/phone-codes/phone-ca.js
  18. 1 1
      dist/inputmask/phone-codes/phone-hu.js
  19. 1 1
      dist/inputmask/phone-codes/phone-it.js
  20. 1 1
      dist/inputmask/phone-codes/phone-mx.js
  21. 1 1
      dist/inputmask/phone-codes/phone-nl.js
  22. 1 1
      dist/inputmask/phone-codes/phone-ru.js
  23. 1 1
      dist/inputmask/phone-codes/phone.js
  24. 5 5
      dist/jquery.inputmask.bundle.js
  25. 1 1
      dist/min/inputmask/bindings/inputmask.binding.min.js
  26. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js
  27. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js
  28. 1 1
      dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.min.js
  29. 1 1
      dist/min/inputmask/global/document.min.js
  30. 1 1
      dist/min/inputmask/global/window.min.js
  31. 2 2
      dist/min/inputmask/inputmask.date.extensions.min.js
  32. 1 1
      dist/min/inputmask/inputmask.extensions.min.js
  33. 1 1
      dist/min/inputmask/inputmask.min.js
  34. 1 1
      dist/min/inputmask/inputmask.numeric.extensions.min.js
  35. 1 1
      dist/min/inputmask/inputmask.phone.extensions.min.js
  36. 1 1
      dist/min/inputmask/jquery.inputmask.min.js
  37. 1 1
      dist/min/inputmask/phone-codes/phone-be.min.js
  38. 1 1
      dist/min/inputmask/phone-codes/phone-ca.min.js
  39. 1 1
      dist/min/inputmask/phone-codes/phone-hu.min.js
  40. 1 1
      dist/min/inputmask/phone-codes/phone-it.min.js
  41. 1 1
      dist/min/inputmask/phone-codes/phone-mx.min.js
  42. 1 1
      dist/min/inputmask/phone-codes/phone-nl.min.js
  43. 1 1
      dist/min/inputmask/phone-codes/phone-ru.min.js
  44. 1 1
      dist/min/inputmask/phone-codes/phone.min.js
  45. 2 2
      dist/min/jquery.inputmask.bundle.min.js
  46. 9 9
      js/inputmask.date.extensions.js
  47. 1 1
      package.json

+ 1 - 1
bower.json

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

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
 	"name": "inputmask",
 	"repository": "robinherbots/Inputmask",
 	"description": "Inputmask is a javascript library which creates an input mask.  Inputmask can run against vanilla javascript, jQuery and jqlite.",
-	"version": "4.0.1-beta.22",
+	"version": "4.0.1-beta.23",
 	"keywords": [
 		"jquery",
 		"plugins",

+ 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": "4.0.1-beta.22",
+  "version": "4.0.1-beta.23",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/Inputmask",

+ 1 - 1
dist/inputmask/bindings/inputmask.binding.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/dependencyLibs/inputmask.dependencyLib.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/global/document.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 "function" == typeof define && define.amd ? define(function() {

+ 1 - 1
dist/inputmask/global/window.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 "function" == typeof define && define.amd ? define(function() {

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

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {
@@ -75,7 +75,7 @@
         }
         return opts.tokenizer;
     }
-    function parse(format, dateObjValue, opts) {
+    function parse(format, dateObjValue, opts, raw) {
         for (var match, mask = ""; match = getTokenizer(opts).exec(format); ) {
             if (void 0 === dateObjValue) if (formatCode[match[0]]) mask += "(" + formatCode[match[0]][0] + ")"; else switch (match[0]) {
               case "[":
@@ -88,7 +88,7 @@
 
               default:
                 mask += Inputmask.escapeRegex(match[0]);
-            } else if (formatCode[match[0]] && formatCode[match[0]][3]) mask += formatCode[match[0]][3].call(dateObjValue.date); else mask += match[0];
+            } else if (formatCode[match[0]]) if (!0 !== raw && formatCode[match[0]][3]) mask += formatCode[match[0]][3].call(dateObjValue.date); else formatCode[match[0]][2] ? mask += dateObjValue["raw" + formatCode[match[0]][2]] : mask += match[0]; else mask += match[0];
         }
         return mask;
     }
@@ -174,7 +174,7 @@
                 }
             },
             onUnMask: function(maskedValue, unmaskedValue, opts) {
-                return this.isComplete(maskedValue) ? parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts) : maskedValue;
+                return parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts, !0);
             },
             casing: function(elem, test, pos, validPositions) {
                 return 0 == test.nativeDef.indexOf("[ap]") ? elem.toLowerCase() : 0 == test.nativeDef.indexOf("[AP]") ? elem.toUpperCase() : elem;

+ 1 - 1
dist/inputmask/inputmask.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/inputmask.numeric.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/inputmask.phone.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-be.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-ca.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-hu.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-it.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-mx.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-nl.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone-ru.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 1 - 1
dist/inputmask/phone-codes/phone.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(factory) {

+ 5 - 5
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(modules) {
@@ -135,7 +135,7 @@
             }
             return opts.tokenizer;
         }
-        function parse(format, dateObjValue, opts) {
+        function parse(format, dateObjValue, opts, raw) {
             for (var match, mask = ""; match = getTokenizer(opts).exec(format); ) if (void 0 === dateObjValue) if (formatCode[match[0]]) mask += "(" + formatCode[match[0]][0] + ")"; else switch (match[0]) {
               case "[":
                 mask += "(";
@@ -147,10 +147,10 @@
 
               default:
                 mask += Inputmask.escapeRegex(match[0]);
-            } else if (formatCode[match[0]] && formatCode[match[0]][3]) {
+            } else if (formatCode[match[0]]) if (!0 !== raw && formatCode[match[0]][3]) {
                 var getFn = formatCode[match[0]][3];
                 mask += getFn.call(dateObjValue.date);
-            } else mask += match[0];
+            } else formatCode[match[0]][2] ? mask += dateObjValue["raw" + formatCode[match[0]][2]] : mask += match[0]; else mask += match[0];
             return mask;
         }
         function pad(val, len) {
@@ -235,7 +235,7 @@
                     }
                 },
                 onUnMask: function(maskedValue, unmaskedValue, opts) {
-                    return this.isComplete(maskedValue) ? parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts) : maskedValue;
+                    return parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts, !0);
                 },
                 casing: function(elem, test, pos, validPositions) {
                     return 0 == test.nativeDef.indexOf("[ap]") ? elem.toLowerCase() : 0 == test.nativeDef.indexOf("[AP]") ? elem.toUpperCase() : elem;

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


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jqlite.min.js


+ 1 - 1
dist/min/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 !function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):window.dependencyLib=e(jQuery)}(function(e){return e});

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


+ 1 - 1
dist/min/inputmask/global/document.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 "function"==typeof define&&define.amd?define(function(){return document}):"object"==typeof exports&&(module.exports=document);

+ 1 - 1
dist/min/inputmask/global/window.min.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/Inputmask
 * Copyright (c) 2010 - 2018 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 4.0.1-beta.22
+* Version: 4.0.1-beta.23
 */
 
 "function"==typeof define&&define.amd?define(function(){return window}):"object"==typeof exports&&(module.exports=window);

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


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


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


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


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


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


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-be.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ca.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-hu.min.js


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


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-mx.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-nl.min.js


File diff suppressed because it is too large
+ 1 - 1
dist/min/inputmask/phone-codes/phone-ru.min.js


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


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


+ 9 - 9
js/inputmask.date.extensions.js

@@ -125,7 +125,7 @@
 
         //parse the given format and return a mask pattern
         //when a dateObjValue is passed a datestring in the requested format is returned
-        function parse(format, dateObjValue, opts) {
+        function parse(format, dateObjValue, opts, raw) {
             //parse format to regex string
             var mask = "", match;
             while (match = getTokenizer(opts).exec(format)) {
@@ -146,9 +146,13 @@
                     }
                 }
                 else {
-                    if (formatCode[match[0]] && formatCode[match[0]][3]) {
-                        var getFn = formatCode[match[0]][3];
-                        mask += getFn.call(dateObjValue.date);
+                    if (formatCode[match[0]]) {
+                        if (raw !== true && formatCode[match[0]][3]) {
+                            var getFn = formatCode[match[0]][3];
+                            mask += getFn.call(dateObjValue.date);
+                        }
+                        else if (formatCode[match[0]][2]) mask += dateObjValue["raw" + formatCode[match[0]][2]];
+                        else mask += match[0];
                     }
                     else mask += match[0];
                 }
@@ -281,11 +285,7 @@
                     }
                 },
                 onUnMask: function (maskedValue, unmaskedValue, opts) {
-                    if (this.isComplete(maskedValue)) {
-                        return parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts);
-                    }
-
-                    return maskedValue;
+                    return parse(opts.outputFormat, analyseMask(maskedValue, opts.inputFormat, opts), opts, true);
                 },
                 casing: function (elem, test, pos, validPositions) {
                     if (test.nativeDef.indexOf("[ap]") == 0) return elem.toLowerCase();

+ 1 - 1
package.json

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