mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
fixed mask with moment formatting
This commit is contained in:
parent
1639a23e47
commit
a6b3af41d9
23
dist/javascripts/jquery.datetimepicker.js
vendored
23
dist/javascripts/jquery.datetimepicker.js
vendored
@ -653,6 +653,18 @@
|
||||
options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
|
||||
}
|
||||
};
|
||||
var setMaskFormat=function(options){
|
||||
if (options.mask === true) {
|
||||
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');
|
||||
}
|
||||
};
|
||||
var NS, XDE_KEYUP, XDE_AFTEROPEN, XDE_BLUR, XDE_CHANGEDATETIME, XDE_CLICK, XDE_CLOSE, XDE_DBLCLICK, XDE_FOCUSIN, XDE_GENERATE, XDE_KEYDOWN,
|
||||
XDE_MOUSEDOWN, XDE_MOUSEUP, XDE_MOUSEWHEEL, XDE_OPEN, XDE_RESIZE, XDE_TOGGLE, XDE_XCHANGE, XDE_ERROR_INPUT, XDE_SELECT, XDE_RESIZE_SCROLL,
|
||||
XDE_SCROLL_ELEMENT, XDE_SCROLLER_MOUSEDOWN, XDE_SCROLLER_MOUSEMOVE, XDE_SCROLLER_MOUSEUP, XDE_SCROLLER_RESIZE_SCROLL, XDE_SCROLLER_SCROLL_ELEMENT,
|
||||
@ -1253,16 +1265,7 @@
|
||||
};
|
||||
input.off(XDE_KEYDOWN);
|
||||
|
||||
if (options.mask === true) {
|
||||
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');
|
||||
}
|
||||
setMaskFormat(options);
|
||||
|
||||
if ($.type(options.mask) === 'string') {
|
||||
if (!isValidValue(options.mask, input.val())) {
|
||||
|
29
dist/javascripts/jquery.moment.datetimepicker.js
vendored
29
dist/javascripts/jquery.moment.datetimepicker.js
vendored
@ -27,6 +27,24 @@
|
||||
var setDayOfWeekStart=function(options){
|
||||
options.dayOfWeekStart=moment.localeData().firstDayOfWeek();
|
||||
};
|
||||
var setMaskFormat=function(options){
|
||||
if (options.mask === true) {
|
||||
options.mask = options.format
|
||||
.replace(/Y/g, '9')
|
||||
.replace(/MM/g, '19')
|
||||
.replace(/DD/g, '39')
|
||||
.replace(/M/g, '19')
|
||||
.replace(/D/g, '39')
|
||||
.replace(/HH/g, '29')
|
||||
.replace(/hh/g, '19')
|
||||
.replace(/H/g, '29')
|
||||
.replace(/h/g, '19')
|
||||
.replace(/mm/g, '59')
|
||||
.replace(/ss/g, '59')
|
||||
.replace(/m/g, '59')
|
||||
.replace(/s/g, '59');
|
||||
}
|
||||
};
|
||||
var NS, XDE_KEYUP, XDE_AFTEROPEN, XDE_BLUR, XDE_CHANGEDATETIME, XDE_CLICK, XDE_CLOSE, XDE_DBLCLICK, XDE_FOCUSIN, XDE_GENERATE, XDE_KEYDOWN,
|
||||
XDE_MOUSEDOWN, XDE_MOUSEUP, XDE_MOUSEWHEEL, XDE_OPEN, XDE_RESIZE, XDE_TOGGLE, XDE_XCHANGE, XDE_ERROR_INPUT, XDE_SELECT, XDE_RESIZE_SCROLL,
|
||||
XDE_SCROLL_ELEMENT, XDE_SCROLLER_MOUSEDOWN, XDE_SCROLLER_MOUSEMOVE, XDE_SCROLLER_MOUSEUP, XDE_SCROLLER_RESIZE_SCROLL, XDE_SCROLLER_SCROLL_ELEMENT,
|
||||
@ -627,16 +645,7 @@
|
||||
};
|
||||
input.off(XDE_KEYDOWN);
|
||||
|
||||
if (options.mask === true) {
|
||||
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');
|
||||
}
|
||||
setMaskFormat(options);
|
||||
|
||||
if ($.type(options.mask) === 'string') {
|
||||
if (!isValidValue(options.mask, input.val())) {
|
||||
|
@ -598,16 +598,7 @@ $.fn.datetimepicker = function(opt) {
|
||||
};
|
||||
input.off(XDE_KEYDOWN);
|
||||
|
||||
if (options.mask === true) {
|
||||
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');
|
||||
}
|
||||
setMaskFormat(options);
|
||||
|
||||
if ($.type(options.mask) === 'string') {
|
||||
if (!isValidValue(options.mask, input.val())) {
|
||||
|
@ -433,6 +433,18 @@
|
||||
options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
|
||||
}
|
||||
};
|
||||
var setMaskFormat=function(options){
|
||||
if (options.mask === true) {
|
||||
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');
|
||||
}
|
||||
};
|
||||
//= datetimepicker.base.js
|
||||
});
|
||||
//= parse.js
|
@ -27,5 +27,23 @@
|
||||
var setDayOfWeekStart=function(options){
|
||||
options.dayOfWeekStart=moment.localeData().firstDayOfWeek();
|
||||
};
|
||||
var setMaskFormat=function(options){
|
||||
if (options.mask === true) {
|
||||
options.mask = options.format
|
||||
.replace(/Y/g, '9')
|
||||
.replace(/MM/g, '19')
|
||||
.replace(/DD/g, '39')
|
||||
.replace(/M/g, '19')
|
||||
.replace(/D/g, '39')
|
||||
.replace(/HH/g, '29')
|
||||
.replace(/hh/g, '19')
|
||||
.replace(/H/g, '29')
|
||||
.replace(/h/g, '19')
|
||||
.replace(/mm/g, '59')
|
||||
.replace(/ss/g, '59')
|
||||
.replace(/m/g, '59')
|
||||
.replace(/s/g, '59');
|
||||
}
|
||||
};
|
||||
//= datetimepicker.base.js
|
||||
});
|
Loading…
Reference in New Issue
Block a user