ソースを参照

Auto-completion of time hours, minutes & seconds in date extension #570

Robin Herbots 11 年 前
コミット
4289e5b51c

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.0.53",
+  "version": "3.0.54",
   "main": "./dist/jquery.inputmask.bundle.js",
   "keywords" : ["jQuery", "plugins", "input", "form", "inputmask", "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.minor = 0
-build.revision = 53
+build.revision = 54
 
 target = jquery.inputmask.bundle.js
 target.min = jquery.inputmask.bundle.min.js

ファイルの差分が大きいため隠しています
+ 881 - 856
dist/jquery.inputmask.bundle.js


ファイルの差分が大きいため隠しています
+ 70 - 69
dist/jquery.inputmask.bundle.min.js


ファイルの差分が大きいため隠しています
+ 1 - 1
dist/min/jquery.inputmask-multi.js


ファイルの差分が大きいため隠しています
+ 5 - 4
dist/min/jquery.inputmask.date.extensions.js


ファイルの差分が大きいため隠しています
+ 2 - 2
dist/min/jquery.inputmask.js


+ 1 - 1
jquery.inputmask.jquery.json

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

+ 26 - 1
js/jquery.inputmask.date.extensions.js

@@ -341,7 +341,9 @@ Optional extensions on the jquery.inputmask base
                 hrspre: new RegExp("[012]"), //hours pre
                 hrs24: new RegExp("2[0-4]|1[3-9]"),
                 hrs: new RegExp("[01][0-9]|2[0-4]"), //hours
-                ampm: new RegExp("^[a|p|A|P][m|M]")
+                ampm: new RegExp("^[a|p|A|P][m|M]"),
+                mspre: new RegExp("[0-5]"), //minutes/seconds pre
+                ms: new RegExp("[0-5][0-9]")
             },
             timeseparator: ':',
             hourFormat: "24", // or 12
@@ -412,6 +414,25 @@ Optional extensions on the jquery.inputmask base
                         }, cardinality: 1
                     }]
                 },
+                's': { //seconds || minutes
+                    validator: "[0-5][0-9]",
+                    cardinality: 2,
+                    prevalidator: [
+                        {
+                            validator: function (chrs, maskset, pos, strict, opts) {
+                                var isValid = opts.regex.mspre.test(chrs);
+                                if (!strict && !isValid) {
+                                    isValid = opts.regex.ms.test("0" + chrs);
+                                    if (isValid) {
+                                        maskset.buffer[pos] = "0";
+                                        pos++;
+                                        return { "pos": pos };
+                                    }
+                                }
+                                return isValid;
+                            }, cardinality: 1
+                        }]
+                },
                 't': { //am/pm
                     validator: function (chrs, maskset, pos, strict, opts) {
                         return opts.regex.ampm.test(chrs + "m");
@@ -443,10 +464,14 @@ Optional extensions on the jquery.inputmask base
         },
         'hh:mm:ss': {
             mask: "h:s:s",
+            placeholder: "hh:mm:ss",
+            alias: "datetime",
             autoUnmask: false
         },
         'hh:mm': {
             mask: "h:s",
+            placeholder: "hh:mm",
+            alias: "datetime",
             autoUnmask: false
         },
         'date': {