diff --git a/dist/javascripts/jquery.datetimepicker.js b/dist/javascripts/jquery.datetimepicker.js index 5e483ac..84c9a8f 100644 --- a/dist/javascripts/jquery.datetimepicker.js +++ b/dist/javascripts/jquery.datetimepicker.js @@ -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())) { diff --git a/dist/javascripts/jquery.moment.datetimepicker.js b/dist/javascripts/jquery.moment.datetimepicker.js index 36edb47..cd1e381 100644 --- a/dist/javascripts/jquery.moment.datetimepicker.js +++ b/dist/javascripts/jquery.moment.datetimepicker.js @@ -26,6 +26,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, @@ -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())) { diff --git a/javascripts/datetimepicker.base.js b/javascripts/datetimepicker.base.js index 3077348..17ca74e 100644 --- a/javascripts/datetimepicker.base.js +++ b/javascripts/datetimepicker.base.js @@ -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())) { diff --git a/javascripts/jquery.datetimepicker.js b/javascripts/jquery.datetimepicker.js index 9b7a776..630ba09 100644 --- a/javascripts/jquery.datetimepicker.js +++ b/javascripts/jquery.datetimepicker.js @@ -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 \ No newline at end of file diff --git a/javascripts/jquery.moment.datetimepicker.js b/javascripts/jquery.moment.datetimepicker.js index 62e45cb..271a791 100644 --- a/javascripts/jquery.moment.datetimepicker.js +++ b/javascripts/jquery.moment.datetimepicker.js @@ -26,6 +26,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'); + } }; //= datetimepicker.base.js }); \ No newline at end of file