rumine-web/static/wagtailadmin/js/vendor/jquery.datetimepicker.js

2 lines
60 KiB
JavaScript
Raw Normal View History

2024-03-13 07:49:06 +01:00
/*! For license information please see jquery.datetimepicker.js.LICENSE.txt */
!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof module&&module.exports?module.exports=t():e.DateFormatter=t()}("undefined"!=typeof self?self:this,(function(){var e,t;return t={DAY:864e5,HOUR:3600,defaults:{dateSettings:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],meridiem:["AM","PM"],ordinal:function(e){var t=e%10,a={1:"st",2:"nd",3:"rd"};return 1!==Math.floor(e%100/10)&&a[t]?a[t]:"th"}},separators:/[ \-+\/.:@]/g,validParts:/[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,intParts:/[djwNzmnyYhHgGis]/g,tzParts:/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,tzClip:/[^-+\dA-Z]/g},getInt:function(e,t){return parseInt(e,t||10)},compare:function(e,t){return"string"==typeof e&&"string"==typeof t&&e.toLowerCase()===t.toLowerCase()},lpad:function(e,a,n){var r=e.toString();return n=n||"0",r.length<a?t.lpad(n+r,a):r},merge:function(e){var a,n;for(e=e||{},a=1;a<arguments.length;a++)if(n=arguments[a])for(var r in n)n.hasOwnProperty(r)&&("object"==typeof n[r]?t.merge(e[r],n[r]):e[r]=n[r]);return e},getIndex:function(e,t){for(var a=0;a<t.length;a++)if(t[a].toLowerCase()===e.toLowerCase())return a;return-1}},(e=function(e){var a=this,n=t.merge(t.defaults,e);a.dateSettings=n.dateSettings,a.separators=n.separators,a.validParts=n.validParts,a.intParts=n.intParts,a.tzParts=n.tzParts,a.tzClip=n.tzClip}).prototype={constructor:e,getMonth:function(e){var a;return 0===(a=t.getIndex(e,this.dateSettings.monthsShort)+1)&&(a=t.getIndex(e,this.dateSettings.months)+1),a},parseDate:function(e,a){var n,r,o,i,s,d,u,l,f,c,m=this,h=!1,g=!1,p=m.dateSettings,D={date:null,year:null,month:null,day:null,hour:0,min:0,sec:0};if(!e)return null;if(e instanceof Date)return e;if("U"===a)return(o=t.getInt(e))?new Date(1e3*o):e;switch(typeof e){case"number":return new Date(e);case"string":break;default:return null}if(!(n=a.match(m.validParts))||0===n.length)throw new Error("Invalid date format definition.");for(o=n.length-1;o>=0;o--)"S"===n[o]&&n.splice(o,1);for(r=e.replace(m.separators,"\0").split("\0"),o=0;o<r.length;o++)switch(i=r[o],s=t.getInt(i),n[o]){case"y":case"Y":if(!s)return null;f=i.length,D.year=2===f?t.getInt((70>s?"20":"19")+i):s,h=!0;break;case"m":case"n":case"M":case"F":if(isNaN(s)){if(!((d=m.getMonth(i))>0))return null;D.month=d}else{if(!(s>=1&&12>=s))return null;D.month=s}h=!0;break;case"d":case"j":if(!(s>=1&&31>=s))return null;D.day=s,h=!0;break;case"g":case"h":if(c=r[u=n.indexOf("a")>-1?n.indexOf("a"):n.indexOf("A")>-1?n.indexOf("A"):-1],-1!==u)l=t.compare(c,p.meridiem[0])?0:t.compare(c,p.meridiem[1])?12:-1,s>=1&&12>=s&&-1!==l?D.hour=s%12==0?l:s+l:s>=0&&23>=s&&(D.hour=s);else{if(!(s>=0&&23>=s))return null;D.hour=s}g=!0;break;case"G":case"H":if(!(s>=0&&23>=s))return null;D.hour=s,g=!0;break;case"i":if(!(s>=0&&59>=s))return null;D.min=s,g=!0;break;case"s":if(!(s>=0&&59>=s))return null;D.sec=s,g=!0}if(!0===h){var y=D.year||0,v=D.month?D.month-1:0,b=D.day||1;D.date=new Date(y,v,b,D.hour,D.min,D.sec,0)}else{if(!0!==g)return null;D.date=new Date(0,0,0,D.hour,D.min,D.sec,0)}return D.date},guessDate:function(e,a){if("string"!=typeof e)return e;var n,r,o,i,s,d,u=e.replace(this.separators,"\0").split("\0"),l=a.match(this.validParts),f=new Date,c=0;if(!/^[djmn]/g.test(l[0]))return e;for(o=0;o<u.length;o++){if(c=2,s=u[o],d=t.getInt(s.substr(0,2)),isNaN(d))return null;switch(o){case 0:"m"===l[0]||"n"===l[0]?f.setMonth(d-1):f.setDate(d);break;case 1:"m"===l[0]||"n"===l[0]?f.setDate(d):f.setMonth(d-1);break;case 2:if(r=f.getFullYear(),c=4>(n=s.length)?n:4,!(r=t.getInt(4>n?r.toString().substr(0,4-n)+s:s.substr(0,4))))return null;f.setFullYear(r);break;case 3:f.setHours(d);break;case 4:f.setMinutes(d);break;case 5:f.setSeconds(d)}(i=s.substr(c)).length>0&&u.spli