| 123456789 |
- /*!
- * inputmask.date.extensions.min.js
- * https://github.com/RobinHerbots/Inputmask
- * Copyright (c) 2010 - 2018 Robin Herbots
- * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
- * Version: 4.0.0-beta.5
- */
- !function(t){"function"==typeof define&&define.amd?define(["./dependencyLibs/inputmask.dependencyLib","./inputmask"],t):"object"==typeof exports?module.exports=t(require("./dependencyLibs/inputmask.dependencyLib"),require("./inputmask")):t(window.dependencyLib||jQuery,window.Inputmask)}(function(t,e){var o={d:["[1-9]|[12][0-9]|3[01]",Date.prototype.setDate,"day",Date.prototype.getDate],dd:["0[1-9]|[12][0-9]|3[01]",Date.prototype.setDate,"day",function(){return i(Date.prototype.getDate.call(this),2)}],ddd:[""],dddd:[""],m:["[1-9]|1[012]",Date.prototype.setMonth,"month",function(){return Date.prototype.getMonth.call(this)+1}],mm:["0[1-9]|1[012]",Date.prototype.setMonth,"month",function(){return i(Date.prototype.getMonth.call(this)+1,2)}],mmm:[""],mmmm:[""],yy:["[0-9]{2}",Date.prototype.setFullYear,"year",function(){return i(Date.prototype.getFullYear.call(this),2)}],yyyy:["[0-9]{4}",Date.prototype.setFullYear,"year",function(){return i(Date.prototype.getFullYear.call(this),4)}],h:["[1-9]|1[0-2]",Date.prototype.setHours,"hours",Date.prototype.getHours],hh:["0[1-9]|1[0-2]",Date.prototype.setHours,"hours",function(){return i(Date.prototype.getHours.call(this),2)}],hhh:["[0-9]+",Date.prototype.setHours,"hours",Date.prototype.getHours],H:["1?[0-9]|2[0-3]",Date.prototype.setHours,"hours",Date.prototype.getHours],HH:["[01][0-9]|2[0-3]",Date.prototype.setHours,"hours",function(){return i(Date.prototype.getHours.call(this),2)}],HHH:["[0-9]+",Date.prototype.setHours,"hours",Date.prototype.getHours],M:["[1-5]?[0-9]",Date.prototype.setMinutes,"minutes",Date.prototype.getMinutes],MM:["[0-5][0-9]",Date.prototype.setMinutes,"minutes",function(){return i(Date.prototype.getMinutes.call(this),2)}],s:["[1-5]?[0-9]",Date.prototype.setSeconds,"seconds",Date.prototype.getSeconds],ss:["[0-5][0-9]",Date.prototype.setSeconds,"seconds",function(){return i(Date.prototype.getSeconds.call(this),2)}],l:["[0-9]{3}",Date.prototype.setMilliseconds,"milliseconds",function(){return i(Date.prototype.getMilliseconds.call(this),3)}],L:["[0-9]{2}",Date.prototype.setMilliseconds,"milliseconds",function(){return i(Date.prototype.getMilliseconds.call(this),2)}],t:["[ap]"],tt:["[ap]m"],T:["[AP]"],TT:["[AP]M"],Z:[""],o:[""],S:[""]},a={isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"};function r(t){if(!t.tokenizer){var e=[];for(var a in o)-1===e.indexOf(a[0])&&e.push(a[0]);t.tokenizer="("+e.join("+|")+")+?|.",t.tokenizer=new RegExp(t.tokenizer,"g")}return t.tokenizer}function n(t,a,n){for(var i,s="";i=r(n).exec(t);){if(void 0===a)s+=o[i[0]]?"("+o[i[0]][0]+")":e.escapeRegex(i[0]);else if(o[i[0]])s+=o[i[0]][3].call(a.date);else s+=i[0]}return s}function i(t,e){for(t=String(t),e=e||2;t.length<e;)t="0"+t;return t}function s(t,e,a){var n,i,s,u={date:new Date(1,0,1)},p=t;function y(t,e,o){var r,i;"year"===n?(t[n]=(i=4===(r=e).length?r:(new Date).getFullYear().toString().substr(0,4-r.length)+r,a.min&&a.min.year&&a.max&&a.max.year?(i=i.replace(/[^0-9]/g,""),i=r.charAt(0)===a.max.year.charAt(0)?r.replace(/[^0-9]/g,"0"):i+a.min.year.substr(i.length)):i=i.replace(/[^0-9]/g,"0"),i),t["raw"+n]=e):t[n]=o.min&&e.match(/[^0-9]/)?o.min[n]:e,void 0!==s&&s.call(t.date,"month"==n?parseInt(t[n])-1:t[n])}if("string"==typeof p){for(;i=r(a).exec(e);){var d=p.slice(0,i[0].length);o.hasOwnProperty(i[0])&&(n=o[i[0]][2],s=o[i[0]][1],y(u,d,a)),p=p.slice(d.length)}return u}}return e.extendAliases({datetime:{mask:function(t){return o.S=t.i18n.ordinalSuffix.join("|"),t.inputFormat=a[t.inputFormat]||t.inputFormat,t.displayFormat=a[t.displayFormat]||t.displayFormat||t.inputFormat,t.outputFormat=a[t.outputFormat]||t.outputFormat||t.inputFormat,t.placeholder=t.placeholder!==e.prototype.defaults.placeholder?t.placeholder:t.inputFormat,t.min=s(t.min,t.inputFormat,t),t.max=s(t.max,t.inputFormat,t),t.regex=n(t.inputFormat,void 0,t),null},inputFormat:"isoDateTime",displayFormat:void 0,outputFormat:void 0,min:null,max:null,i18n:{dayNames:["Mon","Tue","Wed","Thu","Fri","Sat","Sun","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],ordinalSuffix:["st","nd","rd","th"]},postValidation:function(t,e,o){var a,r,n,i,u,p=e,y=s(t.join(""),o.inputFormat,o);return p&&y.date.getTime()==y.date.getTime()&&(i=y,u=p,p=(p=(!isFinite(i.day)||"29"==i.day&&!isFinite(i.rawyear)||new Date(i.date.getFullYear(),isFinite(i.month)?i.month:i.date.getMonth()+1,0).getDate()>=i.day)&&u)&&(a=y.date,n=!0,(r=o).min&&r.min.date.getTime()==r.min.date.getTime()&&(n=n&&r.min.date.getTime()<=a.getTime()),r.max&&r.max.date.getTime()==r.max.date.getTime()&&(n=n&&r.max.date.getTime()>=a.getTime()),n)),p},onKeyDown:function(o,a,n,s){if(o.ctrlKey&&o.keyCode===e.keyCode.RIGHT){for(var u,p=new Date,y="";u=r(s).exec(s.inputFormat);)"d"===u[0].charAt(0)?y+=i(p.getDate(),u[0].length):"m"===u[0].charAt(0)?y+=i(p.getMonth()+1,u[0].length):"yyyy"===u[0]?y+=p.getFullYear().toString():"y"===u[0].charAt(0)&&(y+=i(p.getYear(),u[0].length));this.inputmask._valueSet(y),t(this).trigger("setvalue")}},onUnMask:function(t,e,o){return n(o.outputFormat,s(t,o.inputFormat,o),o)},casing:function(t,e,o,a){return 0==e.nativeDef.indexOf("[ap]")?t.toLowerCase():0==e.nativeDef.indexOf("[AP]")?t.toUpperCase():t},insertMode:!1}}),e});
|