1 line
17 KiB
JavaScript
1 line
17 KiB
JavaScript
|
(()=>{"use strict";var t=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,n="[1-9]\\d?",e="\\d\\d",r="[^\\s]+",i=/\[([^]*?)\]/gm;function o(t,n){for(var e=[],r=0,i=t.length;r<i;r++)e.push(t[r].substr(0,n));return e}var a=function(t){return function(n,e){var r=e[t].map((function(t){return t.toLowerCase()})).indexOf(n.toLowerCase());return r>-1?r:null}};function u(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];for(var r=0,i=n;r<i.length;r++){var o=i[r];for(var a in o)t[a]=o[a]}return t}var c=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s=["January","February","March","April","May","June","July","August","September","October","November","December"],f=o(s,3),l={dayNamesShort:o(c,3),dayNames:c,monthNamesShort:f,monthNames:s,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][t%10>3?0:(t-t%10!=10?1:0)*t%10]}},d=u({},l),y=function(t,n){for(void 0===n&&(n=2),t=String(t);t.length<n;)t="0"+t;return t},h={D:function(t){return String(t.getDate())},DD:function(t){return y(t.getDate())},Do:function(t,n){return n.DoFn(t.getDate())},d:function(t){return String(t.getDay())},dd:function(t){return y(t.getDay())},ddd:function(t,n){return n.dayNamesShort[t.getDay()]},dddd:function(t,n){return n.dayNames[t.getDay()]},M:function(t){return String(t.getMonth()+1)},MM:function(t){return y(t.getMonth()+1)},MMM:function(t,n){return n.monthNamesShort[t.getMonth()]},MMMM:function(t,n){return n.monthNames[t.getMonth()]},YY:function(t){return y(String(t.getFullYear()),4).substr(2)},YYYY:function(t){return y(t.getFullYear(),4)},h:function(t){return String(t.getHours()%12||12)},hh:function(t){return y(t.getHours()%12||12)},H:function(t){return String(t.getHours())},HH:function(t){return y(t.getHours())},m:function(t){return String(t.getMinutes())},mm:function(t){return y(t.getMinutes())},s:function(t){return String(t.getSeconds())},ss:function(t){return y(t.getSeconds())},S:function(t){return String(Math.round(t.getMilliseconds()/100))},SS:function(t){return y(Math.round(t.getMilliseconds()/10),2)},SSS:function(t){return y(t.getMilliseconds(),3)},a:function(t,n){return t.getHours()<12?n.amPm[0]:n.amPm[1]},A:function(t,n){return t.getHours()<12?n.amPm[0].toUpperCase():n.amPm[1].toUpperCase()},ZZ:function(t){var n=t.getTimezoneOffset();return(n>0?"-":"+")+y(100*Math.floor(Math.abs(n)/60)+Math.abs(n)%60,4)},Z:function(t){var n=t.getTimezoneOffset();return(n>0?"-":"+")+y(Math.floor(Math.abs(n)/60),2)+":"+y(Math.abs(n)%60,2)}},m=function(t){return+t-1},g=[null,n],p=[null,r],b=["isPm",r,function(t,n){var e=t.toLowerCase();return e===n.amPm[0]?0:e===n.amPm[1]?1:null}],v=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var n=(t+"").match(/([+-]|\d\d)/gi);if(n){var e=60*+n[1]+parseInt(n[2],10);return"+"===n[0]?e:-e}return 0}],w=(a("monthNamesShort"),a("monthNames"),{default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"});const _=function(n,e,r){if(void 0===e&&(e=w.default),void 0===r&&(r={}),"number"==typeof n&&(n=new Date(n)),"[object Date]"!==Object.prototype.toString.call(n)||isNaN(n.getTime()))throw new Error("Invalid Date pass to format");var o=[];e=(e=w[e]||e).replace(i,(function(t,n){return o.push(n),"@@@"}));var a=u(u({},d),r);return(e=e.replace(t,(function(t){return h[t](n,a)}))).replace(/@@@/g,(function(){return o.shift()}))};var O=function(){try{(new Date).toLocaleDateString("i")}catch(t){return"RangeError"===t.name}return!1}()?function(t,n){return t.toLocaleDateString(n,{year:"numeric",month:"long",day:"numeric"})}:function(t){return _(t,"mediumDate")},M=function(){try{(new Date).toLocaleString("i")}catch(t){return"RangeError"===t.name}return!1}()?function(t,n){return t.toLocaleString(n,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})}:function(t){return _(t,"haDateTime")},S=function(){try{(new Date).toLocaleTimeString(
|