Merge pull request #398 from Maze-fr/master

Support for Moment.js formats
This commit is contained in:
Valeriy 2016-02-25 18:34:59 +05:00
commit 1c08e89353

View File

@ -1203,14 +1203,25 @@
input.off('keydown.xdsoft'); input.off('keydown.xdsoft');
if (options.mask === true) { if (options.mask === true) {
options.mask = options.format if (typeof moment != 'undefined') {
.replace(/Y/g, '9999') options.mask = options.format
.replace(/F/g, '9999') .replace(/Y{4}/g, '9999')
.replace(/m/g, '19') .replace(/Y{2}/g, '99')
.replace(/d/g, '39') .replace(/M{2}/g, '19')
.replace(/H/g, '29') .replace(/D{2}/g, '39')
.replace(/i/g, '59') .replace(/H{2}/g, '29')
.replace(/s/g, '59'); .replace(/m{2}/g, '59')
.replace(/s{2}/g, '59');
} else {
options.mask = options.format
.replace(/Y/g, '9999')
.replace(/F/g, '9999')
.replace(/m/g, '19')
.replace(/d/g, '39')
.replace(/H/g, '29')
.replace(/i/g, '59')
.replace(/s/g, '59');
}
} }
if ($.type(options.mask) === 'string') { if ($.type(options.mask) === 'string') {