mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
Merge pull request #398 from Maze-fr/master
Support for Moment.js formats
This commit is contained in:
commit
1c08e89353
@ -1203,6 +1203,16 @@
|
||||
input.off('keydown.xdsoft');
|
||||
|
||||
if (options.mask === true) {
|
||||
if (typeof moment != 'undefined') {
|
||||
options.mask = options.format
|
||||
.replace(/Y{4}/g, '9999')
|
||||
.replace(/Y{2}/g, '99')
|
||||
.replace(/M{2}/g, '19')
|
||||
.replace(/D{2}/g, '39')
|
||||
.replace(/H{2}/g, '29')
|
||||
.replace(/m{2}/g, '59')
|
||||
.replace(/s{2}/g, '59');
|
||||
} else {
|
||||
options.mask = options.format
|
||||
.replace(/Y/g, '9999')
|
||||
.replace(/F/g, '9999')
|
||||
@ -1212,6 +1222,7 @@
|
||||
.replace(/i/g, '59')
|
||||
.replace(/s/g, '59');
|
||||
}
|
||||
}
|
||||
|
||||
if ($.type(options.mask) === 'string') {
|
||||
if (!isValidValue(options.mask, input.val())) {
|
||||
|
Loading…
Reference in New Issue
Block a user