@fr0st/datetime 8.0.3 → 8.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -4
- package/dist/frost-datetime.esm.js +3251 -0
- package/dist/frost-datetime.esm.js.map +1 -0
- package/dist/frost-datetime.esm.min.js +2 -0
- package/dist/frost-datetime.esm.min.js.map +1 -0
- package/dist/frost-datetime.js +3257 -3885
- package/dist/frost-datetime.js.map +1 -1
- package/dist/frost-datetime.min.js +1 -1
- package/dist/frost-datetime.min.js.map +1 -1
- package/package.json +19 -14
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).DateTime=t()}(this,function(){"use strict";const e=new Map;function t(t,n){return e.has(t)||e.set(t,n()),e.get(t)}function n(e,t){return new Intl.DateTimeFormat(e,{timeZone:"UTC",...t,calendar:"gregory"})}const r=(new Intl.DateTimeFormat).resolvedOptions(),s={clampDates:!0,defaultLocale:r.locale,defaultTimeZone:r.timeZone},i=/(?:\b(?:UTC|GMT)\b|[T\s]\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[+-]\d{2}(?::?\d{2})?)\b)/i,a="eee MMM dd yyyy",o="yyyy-MM-dd'T'HH:mm:ss.SSSxxx",u="eee MMM dd yyyy HH:mm:ss xx (VV)",h="HH:mm:ss xx (VV)",f=/([a-z])\1*|''|'(?:[^']|'')*'/i,c=[31,28,31,30,31,30,31,31,30,31,30,31],l=/^(?:GMT)?([+-])([01]\d|2[0-3])(?:(:?)([0-5]\d)(?:\3([0-5]\d))?)?$/,d=[["year","weekYear"],["era"],["quarter","month","week","dayOfYear"],["weekOfMonth"],["date","weekDay"],["weekDayInMonth"],["hours24","hours12","dayPeriod"],["minutes","seconds","milliseconds"]],g={year:"diffInYears",month:"diffInMonths",week:"diffInWeeks",day:"diffInDays",hour:"diffInHours",minute:"diffInMinutes",second:"diffInSeconds"},m={month:12,week:null,day:7,hour:24,minute:60,second:60};function w(e){const t=new Date(0);return t.setUTCFullYear(e.getYear(),e.getMonth()-1,e.getDate()),t.getTime()/864e5}function y(e,t,n,r=!0){switch(t=t.withTimeZone(e.getTimeZone()),n){case"year":return D(e,t.withYear(e.getYear()),e.getYear()-t.getYear(),!r,-1);case"month":return D(e,t.withYear(e.getYear(),e.getMonth()),12*(e.getYear()-t.getYear())+e.getMonth()-t.getMonth(),!r,-1);case"week":if(r){const n=e.startOfWeek(),r=t.withLocale(e.getLocale()).startOfWeek();return(w(n)-w(r))/7}return D(e,t.withWeekYear(e.getWeekYear(),e.getWeek()),(e-t)/6048e5,r);case"day":return r?w(e)-w(t):D(e,t.withYear(e.getYear(),e.getMonth(),e.getDate()),(e-t)/864e5,r);case"hour":return D(e,t.withYear(e.getYear(),e.getMonth(),e.getDate()).withHours(e.getHours()),(e-t)/36e5,r);case"minute":return D(e,t.withYear(e.getYear(),e.getMonth(),e.getDate()).withHours(e.getHours(),e.getMinutes()),(e-t)/6e4,r);case"second":return D(e,t.withYear(e.getYear(),e.getMonth(),e.getDate()).withHours(e.getHours(),e.getMinutes(),e.getSeconds()),(e-t)/1e3,r);default:throw new Error("Invalid time unit supplied")}}function p(e){return e.slice().sort((e,t)=>t.length-e.length).map(e=>function(e){return e.replace(/[|\\{}()[\]^$+*?.-]/g,"\\$&")}(`${e}`)).join("|")}function D(e,t,n,r=!0,s=1){return n>0?(n=Math.floor(n),r&&e<t&&(n+=s)):n<0&&(n=Math.ceil(n),r&&e>t&&(n-=s)),n}function k(e){return e.getTime()-6e4*e.getTimeZoneOffset()}function M(e,t){let n=0;for(const r of e){if(r!==t[n])throw new Error(`Unmatched character in DateTime string: ${r}`);n++}}function T(e,t,n=1){const r=e.withTime(t+6e4*e.getTimeZoneOffset()),s=k(r);if(s===t)return r;const i=e.withTime(t+6e4*r.getTimeZoneOffset()),a=k(i);return a===t?i:n<0?s<a?r:i:s>a?r:i}function I(e,r="long"){return t(`periods.${e}.${r}`,()=>{const t=n(e,{hour:"numeric",hourCycle:"h11"});return new Array(2).fill().map((e,n)=>t.formatToParts(Date.UTC(2018,0,1,12*n)).find(e=>"dayPeriod"===e.type).value)})}function Y(e,r="long",s=!0){return t(`days.${e}.${r}.${s}`,()=>{if(s){const t=n(e,{weekday:r});return new Array(7).fill().map((e,n)=>t.format(Date.UTC(2018,0,n)))}const t=n(e,{year:"numeric",month:"numeric",day:"numeric",weekday:r});return new Array(7).fill().map((e,n)=>t.formatToParts(Date.UTC(2018,0,n)).find(e=>"weekday"===e.type).value)})}function O(e,r="long"){return t(`eras.${e}.${r}`,()=>{const t=n(e,{era:r});return new Array(2).fill().map((e,n)=>t.formatToParts(Date.UTC(n-1,0,1)).find(e=>"era"===e.type).value)})}function b(e,r="long",s=!0){return t(`months.${e}.${r}.${s}`,()=>{if(s){const t=n(e,{month:r});return new Array(12).fill().map((e,n)=>t.format(Date.UTC(2018,n,1)))}const t=n(e,{year:"numeric",month:r,day:"numeric"});return new Array(12).fill().map((e,n)=>t.formatToParts(Date.UTC(2018,n,1)).find(e=>"month"===e.type).value)})}function S(e){return t(`numbers.${e}`,()=>{const t=n(e,{minute:"numeric"});return new Array(10).fill().map((e,n)=>t.format(Date.UTC(2018,0,1,0,n)))})}function Z(e,t=null){const n=null===t?"+":`{${t}}`;return`(?:${p(S(e))})${n}`}function W(e,t,n="long",r=!0){return Y(e,n,r)[t]}function L(e,t,n="long",r=!0){return b(e,n,r)[t-1]}function H(e,t,n=0){const r=S(e);return`${t}`.padStart(n,"0").replace(/\d/g,e=>r[e])}function x(e,t=!0,n=!1,r=!0){const s=Math.abs(60*e),i=Math.round(s),a=Number.EPSILON*Math.max(1,s),o=Math.abs(s-i);if(!Number.isFinite(s)||o>a||i>=86400)throw new Error("Invalid time zone offset supplied");const u=Math.floor(i/3600),h=Math.floor(i%3600/60),f=i%60,c=e>0?"-":"+",l=[`${u}`.padStart(2,"0")];return(!n||h||f)&&l.push(`${h}`.padStart(2,"0")),r&&f&&l.push(`${f}`.padStart(2,"0")),c+l.join(t?":":"")}function C(e,n,r){const s=function(e){return"RelativeTimeFormat"in Intl?t(`relativeFormatter.${e}`,()=>new Intl.RelativeTimeFormat(e,{numeric:"auto",style:"long"})):null}(e);if(!s)throw new Error("RelativeTimeFormat not supported");return s.format(n,r)}const U={1:["af","am","ar-il","ar-sa","ar-ye","as","bn","bo","brx","ccp","ceb","chr","dav","doi","dz","ebu","en","es-br","es-bz","es-co","es-do","es-gt","es-hn","es-mx","es-ni","es-pa","es-pe","es-ph","es-pr","es-py","es-sv","es-us","es-ve","fil","fr-ca","gu","guz","haw","he","hi","id","ii","ja","jv","kam","ki","kln","km","kn","ko","kok","ks","lkt","lo","luo","luy","mai","mas","mer","mgh","ml","mni","mr","ms-id","ms-sg","mt","my","nd","ne","om","or","pa","ps-pk","pt","qu","sa","saq","sat","sd","seh","sn","so-et","so-ke","su","sw-ke","ta","te","teo-ke","th","ti","ug","ur","xh","yue","zh","zu"],2:["af-na","ar-001","ar-eh","ar-er","ar-km","ar-lb","ar-ma","ar-mr","ar-ps","ar-so","ar-ss","ar-td","ar-tn","en-001","en-150","en-ai","en-at","en-au","en-bb","en-be","en-bi","en-bm","en-cc","en-ch","en-ck","en-cm","en-cx","en-cy","en-de","en-dg","en-dk","en-er","en-fi","en-fj","en-fk","en-fm","en-gb","en-gd","en-gg","en-gh","en-gi","en-gm","en-gy","en-ie","en-im","en-io","en-je","en-ki","en-kn","en-ky","en-lc","en-lr","en-ls","en-mg","en-mp","en-ms","en-mu","en-mw","en-my","en-na","en-nf","en-ng","en-nl","en-nr","en-nu","en-nz","en-pg","en-pn","en-pw","en-rw","en-sb","en-sc","en-se","en-sh","en-si","en-sl","en-ss","en-sx","en-sz","en-tc","en-tk","en-to","en-tv","en-tz","en-ug","en-vc","en-vg","en-vu","en-zm","ko-kp","mas-tz","pt-ao","pt-ch","pt-cv","pt-gq","pt-gw","pt-lu","pt-st","pt-tl","qu-bo","qu-ec","ta-lk","ta-my","ti-er"],7:["ar","ckb","en-ae","en-sd","fa","fr-dj","fr-dz","fr-sy","kab","lrc","mzn","ps","so-dj","uz-arab","uz-arab-af"]},v={4:["ast","bg","br","ca","ce","cs","cy","da","de","dsb","el","en-at","en-be","en-ch","en-de","en-dk","en-fi","en-fj","en-gb","en-gg","en-gi","en-ie","en-im","en-je","en-nl","en-se","es","et","eu","fi","fo","fr","fur","fy","ga","gd","gl","gsw","gv","hsb","hu","is","it","ksh","kw","lb","lt","nb","nl","nn","no","os-ru","pl","pt-ch","pt-lu","pt-pt","rm","ru","sah","sc","se","sk","smn","sv","tt","wae"],1:["da-gl","el-cy","es-419","es-ar","es-bo","es-br","es-bz","es-cl","es-co","es-cr","es-cu","es-do","es-ea","es-ec","es-gq","es-gt","es-hn","es-ic","es-mx","es-ni","es-pa","es-pe","es-ph","es-pr","es-py","es-sv","es-us","es-uy","es-ve","fr-bf","fr-bi","fr-bj","fr-bl","fr-ca","fr-cd","fr-cf","fr-cg","fr-ci","fr-cm","fr-dj","fr-dz","fr-ga","fr-gn","fr-gq","fr-ht","fr-km","fr-ma","fr-mf","fr-mg","fr-ml","fr-mr","fr-mu","fr-nc","fr-ne","fr-pf","fr-pm","fr-rw","fr-sc","fr-sn","fr-sy","fr-td","fr-tg","fr-tn","fr-vu","fr-wf","fr-yt","nl-aw","nl-bq","nl-cw","nl-sr","nl-sx","ru-by","ru-kg","ru-kz","ru-md","ru-ua"]};function $(e,t,n){for(const n of t)for(const[t,r]of Object.entries(e))if(r.includes(n))return parseInt(t,10);return n}function A(e){return t(`weekInfo.${e}`,()=>{const t=new Intl.Locale(e),n=t.getWeekInfo?.()||t.weekInfo||{};let{firstDay:r=null,minimalDays:s=null}=n;const i=r&&s?[]:function(e){const t=e.toString().split("-x-",1)[0].match(/-u-(?:[a-z0-9]{2,8}-)*rg-([a-z]{2}|\d{3})zzzz(?:-|$)/i),n=t?.[1]||e.region;return[[e.language,e.script,n],[e.language,n],[e.language,e.script],[e.language]].map(e=>e.filter(e=>!!e).join("-").toLowerCase())}(t);if(!r){const e=$(U,i,2);r=1===e?7:e-1}return s||(s=$(v,i,1)),{firstDay:r,minimalDays:s}})}function z(e){return"''"===e?"'":e.slice(1,-1).replace(/''/g,"'")}function B(e){switch(e){case 5:return"narrow";case 4:return"long";default:return"short"}}function E(e,t,n,r,s){const i=Z(r);let a=!0;return e!==i?a=!1:(s||t===i)&&(e=Z(r,n)),{numeric:a,source:e}}function F(e){return A(e).minimalDays}function j(e,t){return(7+parseInt(t,10)-A(e).firstDay%7)%7+1}function G(e,t,n="long",r=!0){const s=Y(e,n,r).indexOf(t);if(-1===s)throw new Error(`Unmatched day string in DateTime string: ${t}`);return j(e,s)}function P(e,t,n="long",r=!0){return b(e,n,r).indexOf(t)+1}function q(e,t){const n=S(e);return Array.from(t,e=>n.indexOf(e)).join("")}function N(e,t){return parseInt(q(e,t),10)}var Q={G:{key:"era",regex:(e,t)=>p(O(e,B(t))),input:(e,t,n)=>function(e,t,n="long"){return O(e,n).indexOf(t)}(e,t,B(n)),output:(e,t)=>{const n=B(t);return e.era(n)}},y:{key:"year",regex:e=>Z(e),input:(e,t,n)=>(t=N(e,t),2!==n||2!==`${t}`.length?t:t>40?1900+t:2e3+t),output:(e,t)=>{let n=e.getYear();return 2===t&&(n=`${n}`.slice(-2)),H(e.getLocale(),Math.abs(n),t)}},Y:{key:"weekYear",regex:e=>Z(e),input:(e,t,n)=>(t=N(e,t),2!==n||2!==`${t}`.length?t:t>40?1900+t:2e3+t),output:(e,t)=>{let n=e.getWeekYear();return 2===t&&(n=`${n}`.slice(-2)),H(e.getLocale(),Math.abs(n),t)}},Q:{key:"quarter",supportsLength:e=>3!==e&&4!==e,regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getQuarter(),t<3?t:0)},q:{key:"quarter",supportsLength:e=>3!==e&&4!==e,regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getQuarter(),t<3?t:0)},M:{key:"month",supportsLength:(e,t)=>!t||5!==e,regex:(e,t)=>{switch(t){case 5:case 4:case 3:return p(b(e,B(t),!1));default:return Z(e)}},input:(e,t,n)=>{switch(n){case 4:case 3:return P(e,t,B(n),!1);default:return N(e,t)}},output:(e,t)=>{const n=e.getLocale(),r=e.getMonth();switch(t){case 5:case 4:case 3:return L(n,r,B(t),!1);default:return H(n,r,t)}}},L:{key:"month",supportsLength:(e,t)=>!t||5!==e,regex:(e,t)=>{switch(t){case 5:case 4:case 3:return p(b(e,B(t)));default:return Z(e)}},input:(e,t,n)=>{switch(n){case 4:case 3:return P(e,t,B(n));default:return N(e,t)}},output:(e,t)=>{const n=e.getLocale(),r=e.getMonth();switch(t){case 5:case 4:case 3:return L(n,r,B(t));default:return H(n,r,t)}}},w:{key:"week",regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getWeek(),t)},W:{key:"weekOfMonth",regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getWeekOfMonth(),t)},d:{key:"date",regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getDate(),t)},D:{key:"dayOfYear",regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getDayOfYear(),t)},F:{key:"weekDayInMonth",regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getWeekDayInMonth(),t)},E:{key:"weekDay",supportsLength:(e,t)=>6!==e&&(!t||5!==e),regex:(e,t)=>p(Y(e,B(t),!1)),input:(e,t,n)=>G(e,t,B(n),!1),output:(e,t)=>{const n=B(t);return W(e.getLocale(),e.getDay(),n,!1)}},e:{key:"weekDay",supportsLength:(e,t)=>6!==e&&(!t||5!==e),regex:(e,t)=>t<3?Z(e):p(Y(e,B(t),!1)),input:(e,t,n)=>n<3?N(e,t):G(e,t,B(n),!1),output:(e,t)=>{const n=e.getLocale();if(t<3)return H(n,e.getWeekDay(),t);const r=B(t);return W(n,e.getDay(),r,!1)}},c:{key:"weekDay",supportsLength:(e,t)=>6!==e&&(!t||5!==e),regex:(e,t)=>t<3?Z(e):p(Y(e,B(t))),input:(e,t,n)=>n<3?N(e,t):G(e,t,B(n)),output:(e,t)=>{const n=e.getLocale();if(t<3)return H(n,e.getWeekDay());const r=B(t);return W(n,e.getDay(),r)}},a:{key:"dayPeriod",supportsLength:e=>e<=4,regex:(e,t)=>p(I(e,B(t))),input:(e,t,n)=>function(e,t,n="long"){return I(e,n).indexOf(t)}(e,t,B(n)),output:(e,t)=>{const n=B(t);return e.dayPeriod(n)}},h:{key:"hours12",regex:e=>Z(e),input:(e,t)=>(12===(t=N(e,t))&&(t=0),t),output:(e,t)=>H(e.getLocale(),e.getHours()%12||12,t)},H:{key:"hours24",regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getHours(),t)},K:{key:"hours12",regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getHours()%12,t)},k:{key:"hours24",regex:e=>Z(e),input:(e,t)=>(24===(t=N(e,t))&&(t=0),t),output:(e,t)=>H(e.getLocale(),e.getHours()||24,t)},m:{key:"minutes",regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getMinutes(),t)},s:{key:"seconds",regex:e=>Z(e),input:(e,t)=>N(e,t),output:(e,t)=>H(e.getLocale(),e.getSeconds(),t)},S:{key:"milliseconds",regex:e=>Z(e),input:(e,t)=>parseInt(q(e,t).padEnd(3,"0").slice(0,3),10),output:(e,t)=>{const n=`${e.getMilliseconds()}`.padStart(3,"0");return H(e.getLocale(),n.padEnd(t,"0").slice(0,t))}},z:{supportsLength:(e,t)=>!t,output:(e,t)=>{const n=B(Math.min(t,4));return e.timeZoneName(n)}},Z:{key:"timeZone",regex:(e,t)=>5===t?"[\\+\\-]\\d{2}\\:\\d{2}(?:\\:\\d{2})?|Z":t>=4?"GMT[\\+\\-]\\d{2}\\:\\d{2}|GMT":"[\\+\\-]\\d{4}",input:(e,t)=>t,output:(e,t)=>{const n=e.getTimeZoneOffset();let r=!0,s="";if(5===t){if(!n)return"Z"}else if(t>=4){if(s="GMT",!n)return s}else r=!1;return s+x(n,r,!1,5===t)}},O:{key:"timeZone",supportsLength:e=>1===e||4===e,regex:(e,t)=>4===t?"GMT[\\+\\-]\\d{2}\\:\\d{2}|GMT":"GMT[\\+\\-]\\d{2}|GMT",input:(e,t)=>t,output:(e,t)=>{const n=e.getTimeZoneOffset();if(!n)return"GMT";let r=!1;return 4===t||(r=!0),"GMT"+x(n,!0,r)}},V:{key:"timeZone",supportsLength:e=>2===e,regex:e=>"([A-Za-z0-9_.+\\-/]+)",input:(e,t)=>t,output:e=>e.getTimeZone()},X:{key:"timeZone",supportsLength:e=>e<=5,regex:(e,t)=>{switch(t){case 5:return"[\\+\\-]\\d{2}\\:\\d{2}(?:\\:\\d{2})?|Z";case 4:return"[\\+\\-]\\d{4}(?:\\d{2})?|Z";case 3:return"[\\+\\-]\\d{2}\\:\\d{2}|Z";case 2:return"[\\+\\-]\\d{4}|Z";default:return"[\\+\\-]\\d{2}(?:\\d{2})?|Z"}},input:(e,t)=>t,output:(e,t)=>{const n=e.getTimeZoneOffset();if(!n)return"Z";let r;switch(t){case 5:case 3:r=!0;break;default:r=!1}return x(n,r,1===t,t>=4)}},x:{key:"timeZone",supportsLength:e=>e<=5,regex:(e,t)=>{switch(t){case 5:return"[\\+\\-]\\d{2}\\:\\d{2}(?:\\:\\d{2})?";case 4:return"[\\+\\-]\\d{4}(?:\\d{2})?";case 3:return"[\\+\\-]\\d{2}\\:\\d{2}";case 2:return"[\\+\\-]\\d{4}";default:return"[\\+\\-]\\d{2}(?:\\d{2})?"}},input:(e,t)=>t,output:(e,t)=>{let n;switch(t){case 5:case 3:n=!0;break;default:n=!1}return x(e.getTimeZoneOffset(),n,1===t,t>=4)}}};class V{#e;#t;#n;#r;#s;static clearDataCache(){e.clear()}static dayOfYear(e,t,n){return new Array(t-1).fill().reduce((t,n,r)=>t+this.daysInMonth(e,r+1),n)}static daysInMonth(e,t){const n=new Date(0);return n.setUTCFullYear(e,t-1,1),t=n.getUTCMonth(),c[t]+(1===t&&this.isLeapYear(n.getUTCFullYear())?1:0)}static daysInYear(e){return this.isLeapYear(e)?366:365}static fromArray(e,t={}){const n=e.slice(0,3),r=e.slice(3);return n.length<3&&n.push(...new Array(3-n.length).fill(1)),r.length<4&&r.push(...new Array(4-r.length).fill(0)),new this(null,t).withTimestamp(0).withYear(...n).withHours(...r)}static fromDate(e,t={}){return new this(e.getTime(),t)}static fromFormat(e,t,n={}){const r="locale"in n?n.locale:s.defaultLocale,i="timeZone"in n?n.timeZone:s.defaultTimeZone,a=[];let o,u=!1;for(;e&&(o=e.match(f));){const n=o[1],s=o.index,i=o[0].length;if(s&&M(e.substring(0,s),t),e=e.substring(s+i),t=t.substring(s),!n){const e=z(o[0]);M(e,t),t=t.substring(e.length),u=!1;continue}if(!(n in Q))throw new Error(`Invalid token in DateTime format: ${n}`);if(!1===Q[n].supportsLength?.(i,!0))throw new Error(`Unsupported parsing token in DateTime format: ${n.repeat(i)}`);const h=u&&!s;let f=null;if(!h){const t=e[0];if(t&&t in Q){const n=e.match(/^(.)\1*/)[0].length;f=Q[t].regex(r,n)}}const{numeric:c,source:l}=E(Q[n].regex(r,i),f,i,r,h),d=t.match(new RegExp(`^${l}`));if(!d)throw new Error(`Unmatched token in DateTime string: ${n}`);const g=d[0],m=Q[n].input(r,g,i);if(null!==m){const e=Q[n].key;a.push({key:e,value:m,literal:g,token:n,length:i})}t=t.substring(g.length),u=c}if(e&&(M(e,t),t=t.substring(e.length)),t)throw new Error(`Unmatched trailing characters in DateTime string: ${t}`);let h=i;for(const{key:e,value:t}of a)"timeZone"===e&&(h=t);let c=this.fromArray([1970,1,1],{locale:r,timeZone:h});const l=function(){let e=!1,t=!0;return{date:{get:e=>e.getDate(),set:(e,t)=>e.withDate(t)},dayPeriod:{get:e=>e.getHours()<12?0:1,set:(n,r)=>{e=r;let s=r?12:0;return t&&(s+=n.getHours()),n.withHours(s)}},dayOfYear:{get:e=>e.getDayOfYear(),set:(e,t)=>e.withDayOfYear(t)},era:{get:e=>e.getYear()<0?0:1,set:(e,t)=>{const n=t?1:-1;return e.withYear(e.getYear()*n)}},hours12:{get:e=>e.getHours()%12,set:(n,r)=>(e&&(r+=12),t=!0,n.withHours(r))},hours24:{get:e=>e.getHours(),set:(e,n)=>(t=!1,e.withHours(n))},milliseconds:{get:e=>e.getMilliseconds(),set:(e,t)=>e.withMilliseconds(t)},minutes:{get:e=>e.getMinutes(),set:(e,t)=>e.withMinutes(t)},month:{get:e=>e.getMonth(),set:(e,t)=>e.withMonth(t)},quarter:{get:e=>e.getQuarter(),set:(e,t)=>e.withQuarter(t)},seconds:{get:e=>e.getSeconds(),set:(e,t)=>e.withSeconds(t)},week:{get:e=>e.getWeek(),set:(e,t)=>e.withWeek(t)},weekDay:{get:e=>e.getWeekDay(),set:(e,t)=>e.withWeekDay(t)},weekDayInMonth:{get:e=>e.getWeekDayInMonth(),set:(e,t)=>e.withWeekDayInMonth(t)},weekOfMonth:{get:e=>e.getWeekOfMonth(),set:(e,t)=>e.withWeekOfMonth(t)},weekYear:{get:e=>e.getWeekYear(),set:(e,t)=>e.withWeekYear(t)},year:{get:e=>{const t=e.getYear();return Math.abs(t)},set:(e,t)=>e.withYear(t)}}}(),g=[];for(const e of d)for(const t of e)if("era"!==t||a.find(e=>"year"===e.key))for(const e of a){const{key:n,value:r}=e;n===t&&(c=l[n].set(c,r),g.push(e))}let m=!0;for(const{key:e,value:t}of g)if(e in l&&l[e].get(c)!==t){m=!1;break}return i!==h&&(c=c.withTimeZone(i)),c.isValid=m,c}static fromISOString(e,t={}){let n=this.fromFormat(o,e,{locale:"en"});return"timeZone"in t&&(n=n.withTimeZone(t.timeZone)),"locale"in t&&(n=n.withLocale(t.locale)),n}static fromTimestamp(e,t={}){return new this(null,t).withTimestamp(e)}static getDefaultLocale(){return s.defaultLocale}static getDefaultTimeZone(){return s.defaultTimeZone}static isLeapYear(e){const t=new Date(0);return t.setUTCFullYear(e,1,29),29===t.getUTCDate()}static now(e={}){return new this(null,e)}static setDateClamping(e){s.clampDates=e}static setDefaultLocale(e){s.defaultLocale=e}static setDefaultTimeZone(e){s.defaultTimeZone=e}constructor(e=null,r={}){let a,o=!1;if(null===e)a=Date.now();else if("number"==typeof e&&Number.isFinite(e))a=e;else{if(e!==`${e}`)throw new Error("Invalid date supplied");if(a=Date.parse(e),isNaN(a))throw new Error("Invalid date string supplied");if(o=!i.test(e),o){const t=function(e){const t=e.match(/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/)||e.match(/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/);if(!t)return null;const[,n,r=1,s=1,i=0,a=0,o=0,u=""]=t,h=new Date(0);return h.setUTCFullYear(n,r-1,s),h.setUTCHours(i,a,o,u.padEnd(3,"0").substring(0,3)),h.getTime()}(e);null===t?a-=6e4*new Date(a).getTimezoneOffset():a=t}}this.#e=new Date(a),this.#t=!1,this.isValid=!0;let u=r.timeZone;u||(u=s.defaultTimeZone),["Z","GMT"].includes(u)&&(u="UTC");const h=u.match(l);if(h?(this.#r=60*h[2]+parseInt(h[4]||0,10)+parseInt(h[5]||0,10)/60,this.#r&&"+"===h[1]&&(this.#r*=-1),this.#r?this.#s=x(this.#r):(this.#t=!0,this.#s="UTC")):(this.#t=!0,this.#s=u),this.#n="locale"in r?r.locale:s.defaultLocale,this.#t&&(this.#r=function(e){const r=e.getTimeZone();if("UTC"===r)return 0;const s=Object.fromEntries(function(e){return t(`dateFormatter.${e}`,()=>n("en",{timeZone:e,hourCycle:"h23",era:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3}))}(r).formatToParts(e).filter(e=>"literal"!==e.type).map(({type:e,value:t})=>[e,t]));let i=parseInt(s.year,10);"BC"===s.era&&(i=1-i);const a=new Date(0);a.setUTCFullYear(i,parseInt(s.month,10)-1,parseInt(s.day,10));const o=a.setUTCHours(parseInt(s.hour,10),parseInt(s.minute,10),parseInt(s.second,10),parseInt(s.fractionalSecond,10));return(e.getTime()-o)/6e4}(this)),o&&this.#r){const e=T(this,a);this.#e.setTime(e.getTime()),this.#r=e.getTimeZoneOffset()}}addDay(){return this.addDays(1)}addDays(e){return T(this,new Date(k(this)).setUTCDate(this.getDate()+e),e)}addHour(){return this.addHours(1)}addHours(e){return this.withTime(this.getTime()+36e5*e)}addMinute(){return this.addMinutes(1)}addMinutes(e){return this.withTime(this.getTime()+6e4*e)}addMonth(){return this.addMonths(1)}addMonths(e){return this.withMonth(this.getMonth()+e)}addSecond(){return this.addSeconds(1)}addSeconds(e){return this.withTime(this.getTime()+1e3*e)}addWeek(){return this.addWeeks(1)}addWeeks(e){return this.withDate(this.getDate()+7*e)}addYear(){return this.addYears(1)}addYears(e){return this.withYear(this.getYear()+e)}dayName(e="long"){return W(this.getLocale(),this.getDay(),e)}dayPeriod(e="long"){return function(e,t,n="long"){return I(e,n)[t]}(this.getLocale(),this.getHours()<12?0:1,e)}daysInMonth(){return this.constructor.daysInMonth(this.getYear(),this.getMonth())}daysInYear(){return this.constructor.daysInYear(this.getYear())}diff(e){return this-e}diffInDays(e,{relative:t=!0}={}){return y(this,e,"day",t)}diffInHours(e,{relative:t=!0}={}){return y(this,e,"hour",t)}diffInMinutes(e,{relative:t=!0}={}){return y(this,e,"minute",t)}diffInMonths(e,{relative:t=!0}={}){return y(this,e,"month",t)}diffInSeconds(e,{relative:t=!0}={}){return y(this,e,"second",t)}diffInWeeks(e,{relative:t=!0}={}){return y(this,e,"week",t)}diffInYears(e,{relative:t=!0}={}){return y(this,e,"year",t)}endOfDay(){return this.withHours(23,59,59,999)}endOfHour(){return this.withMinutes(59,59,999)}endOfMinute(){return this.withSeconds(59,999)}endOfMonth(){return this.withDate(this.daysInMonth()).endOfDay()}endOfQuarter(){const e=3*this.getQuarter();return this.withMonth(e,this.constructor.daysInMonth(this.getYear(),e)).endOfDay()}endOfSecond(){return this.withMilliseconds(999)}endOfWeek(){return this.withWeekDay(7).endOfDay()}endOfYear(){return this.withMonth(12,31).endOfDay()}era(e="long"){return function(e,t,n="long"){return O(e,n)[t]}(this.getLocale(),this.getYear()<0?0:1,e)}format(e){let t,n="";for(;e&&(t=e.match(f));){const r=t[1],s=t.index,i=t[0].length;if(s&&(n+=e.substring(0,s)),e=e.substring(s+i),r){if(!(r in Q))throw new Error(`Invalid token in DateTime format: ${r}`);if(!1===Q[r].supportsLength?.(i))throw new Error(`Unsupported token in DateTime format: ${r.repeat(i)}`);n+=Q[r].output(this,i)}else n+=z(t[0])}return n+=e,n}getDate(){return new Date(k(this)).getUTCDate()}getDay(){return new Date(k(this)).getUTCDay()}getDayOfYear(){return this.constructor.dayOfYear(this.getYear(),this.getMonth(),this.getDate())}getHours(){return new Date(k(this)).getUTCHours()}getLocale(){return this.#n}getMilliseconds(){return new Date(k(this)).getUTCMilliseconds()}getMinutes(){return new Date(k(this)).getUTCMinutes()}getMonth(){return new Date(k(this)).getUTCMonth()+1}getQuarter(){return Math.ceil(this.getMonth()/3)}getSeconds(){return new Date(k(this)).getUTCSeconds()}getTime(){return this.#e.getTime()}getTimestamp(){return Math.floor(this.getTime()/1e3)}getTimeZone(){return this.#s}getTimeZoneOffset(){return this.#r}getWeek(){const e=this.startOfDay().withWeekDay(1),t=e.withWeek(1,1);return 1+Math.floor((k(e)-k(t))/6048e5)}getWeekDay(){return j(this.getLocale(),this.getDay())}getWeekDayInMonth(){const e=this.getWeek(),t=this.withDate(1),n=t.getWeek(),r=t.getWeekDay()>this.getWeekDay()?0:1;return n>e?e+r:e-n+r}getWeekOfMonth(){const e=this.getWeek(),t=this.withDate(1).getWeek();return t>e?e+1:e-t+1}getWeekYear(){const e=F(this.getLocale());return this.withWeekDay(7-e+1).getYear()}getYear(){return new Date(k(this)).getUTCFullYear()}humanDiff(e){const[t,n]=function(e,t){let n;for(const[r,s]of Object.entries(g)){const i=e[s](t);if(n&&m[r]&&Math.abs(i)>=m[r])return n;if(e[s](t,{relative:!1}))return[i,r];n=i?[i,r]:null}return n||[0,"second"]}(this,e);return C(this.getLocale(),t,n)}humanDiffInDays(e){return C(this.getLocale(),this.diffInDays(e),"day")}humanDiffInHours(e){return C(this.getLocale(),this.diffInHours(e),"hour")}humanDiffInMinutes(e){return C(this.getLocale(),this.diffInMinutes(e),"minute")}humanDiffInMonths(e){return C(this.getLocale(),this.diffInMonths(e),"month")}humanDiffInSeconds(e){return C(this.getLocale(),this.diffInSeconds(e),"second")}humanDiffInWeeks(e){return C(this.getLocale(),this.diffInWeeks(e),"week")}humanDiffInYears(e){return C(this.getLocale(),this.diffInYears(e),"year")}isAfter(e){return this.diff(e)>0}isAfterDay(e){return this.diffInDays(e)>0}isAfterHour(e){return this.diffInHours(e)>0}isAfterMinute(e){return this.diffInMinutes(e)>0}isAfterMonth(e){return this.diffInMonths(e)>0}isAfterSecond(e){return this.diffInSeconds(e)>0}isAfterWeek(e){return this.diffInWeeks(e)>0}isAfterYear(e){return this.diffInYears(e)>0}isBefore(e){return this.diff(e)<0}isBeforeDay(e){return this.diffInDays(e)<0}isBeforeHour(e){return this.diffInHours(e)<0}isBeforeMinute(e){return this.diffInMinutes(e)<0}isBeforeMonth(e){return this.diffInMonths(e)<0}isBeforeSecond(e){return this.diffInSeconds(e)<0}isBeforeWeek(e){return this.diffInWeeks(e)<0}isBeforeYear(e){return this.diffInYears(e)<0}isBetween(e,t){return this.isAfter(e)&&this.isBefore(t)}isBetweenDay(e,t){return this.isAfterDay(e)&&this.isBeforeDay(t)}isBetweenHour(e,t){return this.isAfterHour(e)&&this.isBeforeHour(t)}isBetweenMinute(e,t){return this.isAfterMinute(e)&&this.isBeforeMinute(t)}isBetweenMonth(e,t){return this.isAfterMonth(e)&&this.isBeforeMonth(t)}isBetweenSecond(e,t){return this.isAfterSecond(e)&&this.isBeforeSecond(t)}isBetweenWeek(e,t){return this.isAfterWeek(e)&&this.isBeforeWeek(t)}isBetweenYear(e,t){return this.isAfterYear(e)&&this.isBeforeYear(t)}isDst(){if(!this.#t)return!1;const e=this.getYear(),t=this.constructor.fromArray([e,1,1],{timeZone:this.getTimeZone()}),n=this.constructor.fromArray([e,6,1],{timeZone:this.getTimeZone()});return this.getTimeZoneOffset()<Math.max(t.getTimeZoneOffset(),n.getTimeZoneOffset())}isLeapYear(){return this.constructor.isLeapYear(this.getYear())}isSame(e){return 0===this.diff(e)}isSameDay(e){return 0===this.diffInDays(e)}isSameHour(e){return 0===this.diffInHours(e)}isSameMinute(e){return 0===this.diffInMinutes(e)}isSameMonth(e){return 0===this.diffInMonths(e)}isSameOrAfter(e){return this.diff(e)>=0}isSameOrAfterDay(e){return this.diffInDays(e)>=0}isSameOrAfterHour(e){return this.diffInHours(e)>=0}isSameOrAfterMinute(e){return this.diffInMinutes(e)>=0}isSameOrAfterMonth(e){return this.diffInMonths(e)>=0}isSameOrAfterSecond(e){return this.diffInSeconds(e)>=0}isSameOrAfterWeek(e){return this.diffInWeeks(e)>=0}isSameOrAfterYear(e){return this.diffInYears(e)>=0}isSameOrBefore(e){return this.diff(e)<=0}isSameOrBeforeDay(e){return this.diffInDays(e)<=0}isSameOrBeforeHour(e){return this.diffInHours(e)<=0}isSameOrBeforeMinute(e){return this.diffInMinutes(e)<=0}isSameOrBeforeMonth(e){return this.diffInMonths(e)<=0}isSameOrBeforeSecond(e){return this.diffInSeconds(e)<=0}isSameOrBeforeWeek(e){return this.diffInWeeks(e)<=0}isSameOrBeforeYear(e){return this.diffInYears(e)<=0}isSameSecond(e){return 0===this.diffInSeconds(e)}isSameWeek(e){return 0===this.diffInWeeks(e)}isSameYear(e){return 0===this.diffInYears(e)}monthName(e="long"){return L(this.getLocale(),this.getMonth(),e)}startOfDay(){return this.withHours(0,0,0,0)}startOfHour(){return this.withMinutes(0,0,0)}startOfMinute(){return this.withSeconds(0,0)}startOfMonth(){return this.withDate(1).startOfDay()}startOfQuarter(){const e=3*this.getQuarter()-2;return this.withMonth(e,1).startOfDay()}startOfSecond(){return this.withMilliseconds(0)}startOfWeek(){return this.withWeekDay(1).startOfDay()}startOfYear(){return this.withMonth(1,1).startOfDay()}subDay(){return this.addDays(-1)}subDays(e){return this.addDays(-e)}subHour(){return this.addHours(-1)}subHours(e){return this.addHours(-e)}subMinute(){return this.addMinutes(-1)}subMinutes(e){return this.addMinutes(-e)}subMonth(){return this.addMonths(-1)}subMonths(e){return this.addMonths(-e)}subSecond(){return this.addSeconds(-1)}subSeconds(e){return this.addSeconds(-e)}subWeek(){return this.addWeeks(-1)}subWeeks(e){return this.addWeeks(-e)}subYear(){return this.addYears(-1)}subYears(e){return this.addYears(-e)}[Symbol.toPrimitive](e){return"number"===e?this.valueOf():this.toString()}timeZoneName(e="long"){return this.#t?function(e,t,r,s="long"){return n(e,{second:"numeric",timeZone:r,timeZoneName:s}).formatToParts(t).find(e=>"timeZoneName"===e.type).value}(this.getLocale(),this.getTime(),this.getTimeZone(),e):"GMT"+x(this.getTimeZoneOffset(),!0,"short"===e)}toDateString(){return this.format(a)}toIsoString(){return this.withLocale("en").withTimeZone("UTC").format(o)}toJSON(){return this.isValid?this.toIsoString():null}toString(){return this.format(u)}toTimeString(){return this.format(h)}toUTCString(){return this.withLocale("en").withTimeZone("UTC").toString()}valueOf(){return this.getTime()}weeksInYear(){const e=F(this.getLocale());return this.withMonth(12,24+e).getWeek()}withDate(e){return T(this,new Date(k(this)).setUTCDate(e))}withDay(e){return T(this,new Date(k(this)).setUTCDate(this.getDate()-this.getDay()+parseInt(e,10)))}withDayOfYear(e){return T(this,new Date(k(this)).setUTCMonth(0,e))}withHours(...e){return T(this,new Date(k(this)).setUTCHours(...e))}withLocale(e){return new this.constructor(this.getTime(),{locale:e,timeZone:this.#s})}withMilliseconds(e){return T(this,new Date(k(this)).setUTCMilliseconds(e))}withMinutes(...e){return T(this,new Date(k(this)).setUTCMinutes(...e))}withMonth(e,t=null){return null===t&&(t=this.getDate(),s.clampDates&&(t=Math.min(t,this.constructor.daysInMonth(this.getYear(),e)))),T(this,new Date(k(this)).setUTCMonth(e-1,t))}withQuarter(e){return T(this,new Date(k(this)).setUTCMonth(3*e-3))}withSeconds(...e){return T(this,new Date(k(this)).setUTCSeconds(...e))}withTime(e){return new this.constructor(e,{locale:this.#n,timeZone:this.#s})}withTimestamp(e){return this.withTime(1e3*e)}withTimeZone(e){return new this.constructor(this.getTime(),{locale:this.#n,timeZone:e})}withTimeZoneOffset(e){return new this.constructor(this.getTime(),{locale:this.#n,timeZone:x(e)})}withWeek(e,t=null){null===t&&(t=this.getWeekDay());const n=F(this.getLocale());return this.withYear(this.getWeekYear(),1,n+7*(e-1)).withWeekDay(t)}withWeekDay(e){return T(this,new Date(k(this)).setUTCDate(this.getDate()-this.getWeekDay()+parseInt(e,10)))}withWeekDayInMonth(e){return this.withDate(this.getDate()+7*(e-this.getWeekDayInMonth()))}withWeekOfMonth(e){return this.withDate(this.getDate()+7*(e-this.getWeekOfMonth()))}withWeekYear(e,t=null,n=null){const r=F(this.getLocale()),s=this.constructor;return null===t&&(t=Math.min(this.getWeek(),s.fromArray([e,1,r],{locale:this.getLocale(),timeZone:this.getTimeZone()}).weeksInYear())),null===n&&(n=this.getWeekDay()),this.withYear(e,1,r+7*(t-1)).withWeekDay(n)}withYear(e,t=null,n=null){return null===t&&(t=this.getMonth()),null===n&&(n=this.getDate(),s.clampDates&&(n=Math.min(n,this.constructor.daysInMonth(e,t)))),T(this,new Date(k(this)).setUTCFullYear(e,t-1,n))}}return V});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?module.exports=t():typeof define==`function`&&define.amd?define([],t):(e=typeof globalThis<`u`?globalThis:e||self,e.DateTime=t())})(this,function(){var e=new Map;function t(){e.clear()}function n(t,n){return e.has(t)||e.set(t,n()),e.get(t)}function r(e){return n(`dateFormatter.${e}`,()=>a(`en`,{timeZone:e,hourCycle:`h23`,era:`short`,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,fractionalSecondDigits:3}))}function i(e){return`RelativeTimeFormat`in Intl?n(`relativeFormatter.${e}`,()=>new Intl.RelativeTimeFormat(e,{numeric:`auto`,style:`long`})):null}function a(e,t){return new Intl.DateTimeFormat(e,{timeZone:`UTC`,...t,calendar:`gregory`})}var o=new Intl.DateTimeFormat().resolvedOptions(),s={clampDates:!0,defaultLocale:o.locale,defaultTimeZone:o.timeZone},c=/(?:\b(?:UTC|GMT)\b|[T\s]\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[+-]\d{2}(?::?\d{2})?)\b)/i,l={date:`eee MMM dd yyyy`,rfc3339_extended:`yyyy-MM-dd'T'HH:mm:ss.SSSxxx`,string:`eee MMM dd yyyy HH:mm:ss xx (VV)`,time:`HH:mm:ss xx (VV)`},u=/([a-z])\1*|''|'(?:[^']|'')*'/i,d=[31,28,31,30,31,30,31,31,30,31,30,31],f=/^(?:GMT)?([+-])([01]\d|2[0-3])(?:(:?)([0-5]\d)(?:\3([0-5]\d))?)?$/,p=[[`year`,`weekYear`],[`era`],[`quarter`,`month`,`week`,`dayOfYear`],[`weekOfMonth`],[`date`,`weekDay`],[`weekDayInMonth`],[`hours24`,`hours12`,`dayPeriod`],[`minutes`,`seconds`,`milliseconds`]],m={year:`diffInYears`,month:`diffInMonths`,week:`diffInWeeks`,day:`diffInDays`,hour:`diffInHours`,minute:`diffInMinutes`,second:`diffInSeconds`},h={month:12,week:null,day:7,hour:24,minute:60,second:60};function g(e){return e.replace(/[|\\{}()[\]^$+*?.-]/g,`\\$&`)}function _(e){let t=new Date(0);return t.setUTCFullYear(e.getYear(),e.getMonth()-1,e.getDate()),t.getTime()/864e5}function v(e,t,n,r=!0){switch(t=t.withTimeZone(e.getTimeZone()),n){case`year`:return b(e,t.withYear(e.getYear()),e.getYear()-t.getYear(),!r,-1);case`month`:return b(e,t.withYear(e.getYear(),e.getMonth()),(e.getYear()-t.getYear())*12+e.getMonth()-t.getMonth(),!r,-1);case`week`:if(r){let n=e.startOfWeek(),r=t.withLocale(e.getLocale()).startOfWeek();return(_(n)-_(r))/7}return b(e,t.withWeekYear(e.getWeekYear(),e.getWeek()),(e-t)/6048e5,r);case`day`:return r?_(e)-_(t):b(e,t.withYear(e.getYear(),e.getMonth(),e.getDate()),(e-t)/864e5,r);case`hour`:return b(e,t.withYear(e.getYear(),e.getMonth(),e.getDate()).withHours(e.getHours()),(e-t)/36e5,r);case`minute`:return b(e,t.withYear(e.getYear(),e.getMonth(),e.getDate()).withHours(e.getHours(),e.getMinutes()),(e-t)/6e4,r);case`second`:return b(e,t.withYear(e.getYear(),e.getMonth(),e.getDate()).withHours(e.getHours(),e.getMinutes(),e.getSeconds()),(e-t)/1e3,r);default:throw Error(`Invalid time unit supplied`)}}function y(e){return e.slice().sort((e,t)=>t.length-e.length).map(e=>g(`${e}`)).join(`|`)}function b(e,t,n,r=!0,i=1){return n>0?(n=Math.floor(n),r&&e<t&&(n+=i)):n<0&&(n=Math.ceil(n),r&&e>t&&(n-=i)),n}function x(e,t){let n;for(let[r,i]of Object.entries(m)){let a=e[i](t);if(n&&h[r]&&Math.abs(a)>=h[r])return n;if(e[i](t,{relative:!1}))return[a,r];n=a?[a,r]:null}return n||[0,`second`]}function ee(e){let t=e.getTimeZone();if(t===`UTC`)return 0;let n=Object.fromEntries(r(t).formatToParts(e).filter(e=>e.type!==`literal`).map(({type:e,value:t})=>[e,t])),i=parseInt(n.year,10);n.era===`BC`&&(i=1-i);let a=new Date(0);a.setUTCFullYear(i,parseInt(n.month,10)-1,parseInt(n.day,10));let o=a.setUTCHours(parseInt(n.hour,10),parseInt(n.minute,10),parseInt(n.second,10),parseInt(n.fractionalSecond,10));return(e.getTime()-o)/6e4}function S(e){return e.getTime()-e.getTimeZoneOffset()*6e4}function C(e,t){let n=0;for(let r of e){if(r!==t[n])throw Error(`Unmatched character in DateTime string: ${r}`);n++}}function w(e){let t=e.match(/^(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?$/)||e.match(/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/);if(!t)return null;let[,n,r=1,i=1,a=0,o=0,s=0,c=``]=t,l=new Date(0);return l.setUTCFullYear(n,r-1,i),l.setUTCHours(a,o,s,c.padEnd(3,`0`).substring(0,3)),l.getTime()}function T(){let e=!1,t=!0;return{date:{get:e=>e.getDate(),set:(e,t)=>e.withDate(t)},dayPeriod:{get:e=>e.getHours()<12?0:1,set:(n,r)=>{e=r;let i=r?12:0;return t&&(i+=n.getHours()),n.withHours(i)}},dayOfYear:{get:e=>e.getDayOfYear(),set:(e,t)=>e.withDayOfYear(t)},era:{get:e=>e.getYear()<0?0:1,set:(e,t)=>{let n=t?1:-1;return e.withYear(e.getYear()*n)}},hours12:{get:e=>e.getHours()%12,set:(n,r)=>(e&&(r+=12),t=!0,n.withHours(r))},hours24:{get:e=>e.getHours(),set:(e,n)=>(t=!1,e.withHours(n))},milliseconds:{get:e=>e.getMilliseconds(),set:(e,t)=>e.withMilliseconds(t)},minutes:{get:e=>e.getMinutes(),set:(e,t)=>e.withMinutes(t)},month:{get:e=>e.getMonth(),set:(e,t)=>e.withMonth(t)},quarter:{get:e=>e.getQuarter(),set:(e,t)=>e.withQuarter(t)},seconds:{get:e=>e.getSeconds(),set:(e,t)=>e.withSeconds(t)},week:{get:e=>e.getWeek(),set:(e,t)=>e.withWeek(t)},weekDay:{get:e=>e.getWeekDay(),set:(e,t)=>e.withWeekDay(t)},weekDayInMonth:{get:e=>e.getWeekDayInMonth(),set:(e,t)=>e.withWeekDayInMonth(t)},weekOfMonth:{get:e=>e.getWeekOfMonth(),set:(e,t)=>e.withWeekOfMonth(t)},weekYear:{get:e=>e.getWeekYear(),set:(e,t)=>e.withWeekYear(t)},year:{get:e=>{let t=e.getYear();return Math.abs(t)},set:(e,t)=>e.withYear(t)}}}function E(e,t,n=1){let r=e.withTime(t+e.getTimeZoneOffset()*6e4),i=S(r);if(i===t)return r;let a=e.withTime(t+r.getTimeZoneOffset()*6e4),o=S(a);return o===t?a:n<0?i<o?r:a:i>o?r:a}function D(e,t=`long`){return n(`periods.${e}.${t}`,()=>{let t=a(e,{hour:`numeric`,hourCycle:`h11`});return[,,].fill().map((e,n)=>t.formatToParts(Date.UTC(2018,0,1,n*12)).find(e=>e.type===`dayPeriod`).value)})}function O(e,t=`long`,r=!0){return n(`days.${e}.${t}.${r}`,()=>{if(r){let n=a(e,{weekday:t});return Array(7).fill().map((e,t)=>n.format(Date.UTC(2018,0,t)))}let n=a(e,{year:`numeric`,month:`numeric`,day:`numeric`,weekday:t});return Array(7).fill().map((e,t)=>n.formatToParts(Date.UTC(2018,0,t)).find(e=>e.type===`weekday`).value)})}function k(e,t=`long`){return n(`eras.${e}.${t}`,()=>{let n=a(e,{era:t});return[,,].fill().map((e,t)=>n.formatToParts(Date.UTC(t-1,0,1)).find(e=>e.type===`era`).value)})}function A(e,t=`long`,r=!0){return n(`months.${e}.${t}.${r}`,()=>{if(r){let n=a(e,{month:t});return Array(12).fill().map((e,t)=>n.format(Date.UTC(2018,t,1)))}let n=a(e,{year:`numeric`,month:t,day:`numeric`});return Array(12).fill().map((e,t)=>n.formatToParts(Date.UTC(2018,t,1)).find(e=>e.type===`month`).value)})}function j(e){return n(`numbers.${e}`,()=>{let t=a(e,{minute:`numeric`});return Array(10).fill().map((e,n)=>t.format(Date.UTC(2018,0,1,0,n)))})}function M(e,t=null){let n=t===null?`+`:`{${t}}`;return`(?:${y(j(e))})${n}`}function N(e,t,n=`long`,r=!0){return O(e,n,r)[t]}function P(e,t,n=`long`){return D(e,n)[t]}function F(e,t,n=`long`){return k(e,n)[t]}function I(e,t,n=`long`,r=!0){return A(e,n,r)[t-1]}function L(e,t,n=0){let r=j(e);return`${t}`.padStart(n,`0`).replace(/\d/g,e=>r[e])}function R(e,t=!0,n=!1,r=!0){let i=Math.abs(e*60),a=Math.round(i),o=2**-52*Math.max(1,i),s=Math.abs(i-a);if(!Number.isFinite(i)||s>o||a>=86400)throw Error(`Invalid time zone offset supplied`);let c=Math.floor(a/3600),l=Math.floor(a%3600/60),u=a%60,d=e>0?`-`:`+`,f=[`${c}`.padStart(2,`0`)];return(!n||l||u)&&f.push(`${l}`.padStart(2,`0`)),r&&u&&f.push(`${u}`.padStart(2,`0`)),d+f.join(t?`:`:``)}function z(e,t,n){let r=i(e);if(!r)throw Error(`RelativeTimeFormat not supported`);return r.format(t,n)}function B(e,t,n,r=`long`){return a(e,{second:`numeric`,timeZone:n,timeZoneName:r}).formatToParts(t).find(e=>e.type===`timeZoneName`).value}var V={1:`af.am.ar-il.ar-sa.ar-ye.as.bn.bo.brx.ccp.ceb.chr.dav.doi.dz.ebu.en.es-br.es-bz.es-co.es-do.es-gt.es-hn.es-mx.es-ni.es-pa.es-pe.es-ph.es-pr.es-py.es-sv.es-us.es-ve.fil.fr-ca.gu.guz.haw.he.hi.id.ii.ja.jv.kam.ki.kln.km.kn.ko.kok.ks.lkt.lo.luo.luy.mai.mas.mer.mgh.ml.mni.mr.ms-id.ms-sg.mt.my.nd.ne.om.or.pa.ps-pk.pt.qu.sa.saq.sat.sd.seh.sn.so-et.so-ke.su.sw-ke.ta.te.teo-ke.th.ti.ug.ur.xh.yue.zh.zu`.split(`.`),2:`af-na.ar-001.ar-eh.ar-er.ar-km.ar-lb.ar-ma.ar-mr.ar-ps.ar-so.ar-ss.ar-td.ar-tn.en-001.en-150.en-ai.en-at.en-au.en-bb.en-be.en-bi.en-bm.en-cc.en-ch.en-ck.en-cm.en-cx.en-cy.en-de.en-dg.en-dk.en-er.en-fi.en-fj.en-fk.en-fm.en-gb.en-gd.en-gg.en-gh.en-gi.en-gm.en-gy.en-ie.en-im.en-io.en-je.en-ki.en-kn.en-ky.en-lc.en-lr.en-ls.en-mg.en-mp.en-ms.en-mu.en-mw.en-my.en-na.en-nf.en-ng.en-nl.en-nr.en-nu.en-nz.en-pg.en-pn.en-pw.en-rw.en-sb.en-sc.en-se.en-sh.en-si.en-sl.en-ss.en-sx.en-sz.en-tc.en-tk.en-to.en-tv.en-tz.en-ug.en-vc.en-vg.en-vu.en-zm.ko-kp.mas-tz.pt-ao.pt-ch.pt-cv.pt-gq.pt-gw.pt-lu.pt-st.pt-tl.qu-bo.qu-ec.ta-lk.ta-my.ti-er`.split(`.`),7:[`ar`,`ckb`,`en-ae`,`en-sd`,`fa`,`fr-dj`,`fr-dz`,`fr-sy`,`kab`,`lrc`,`mzn`,`ps`,`so-dj`,`uz-arab`,`uz-arab-af`]},H={4:`ast.bg.br.ca.ce.cs.cy.da.de.dsb.el.en-at.en-be.en-ch.en-de.en-dk.en-fi.en-fj.en-gb.en-gg.en-gi.en-ie.en-im.en-je.en-nl.en-se.es.et.eu.fi.fo.fr.fur.fy.ga.gd.gl.gsw.gv.hsb.hu.is.it.ksh.kw.lb.lt.nb.nl.nn.no.os-ru.pl.pt-ch.pt-lu.pt-pt.rm.ru.sah.sc.se.sk.smn.sv.tt.wae`.split(`.`),1:`da-gl.el-cy.es-419.es-ar.es-bo.es-br.es-bz.es-cl.es-co.es-cr.es-cu.es-do.es-ea.es-ec.es-gq.es-gt.es-hn.es-ic.es-mx.es-ni.es-pa.es-pe.es-ph.es-pr.es-py.es-sv.es-us.es-uy.es-ve.fr-bf.fr-bi.fr-bj.fr-bl.fr-ca.fr-cd.fr-cf.fr-cg.fr-ci.fr-cm.fr-dj.fr-dz.fr-ga.fr-gn.fr-gq.fr-ht.fr-km.fr-ma.fr-mf.fr-mg.fr-ml.fr-mr.fr-mu.fr-nc.fr-ne.fr-pf.fr-pm.fr-rw.fr-sc.fr-sn.fr-sy.fr-td.fr-tg.fr-tn.fr-vu.fr-wf.fr-yt.nl-aw.nl-bq.nl-cw.nl-sr.nl-sx.ru-by.ru-kg.ru-kz.ru-md.ru-ua`.split(`.`)};function U(e,t,n){for(let n of t)for(let[t,r]of Object.entries(e))if(r.includes(n))return parseInt(t,10);return n}function te(e){let t=e.toString().split(`-x-`,1)[0].match(/-u-(?:[a-z0-9]{2,8}-)*rg-([a-z]{2}|\d{3})zzzz(?:-|$)/i)?.[1]||e.region;return[[e.language,e.script,t],[e.language,t],[e.language,e.script],[e.language]].map(e=>e.filter(e=>!!e).join(`-`).toLowerCase())}function W(e){return n(`weekInfo.${e}`,()=>{let t=new Intl.Locale(e),{firstDay:n=null,minimalDays:r=null}=t.getWeekInfo?.()||t.weekInfo||{},i=n&&r?[]:te(t);if(!n){let e=U(V,i,2);n=e===1?7:e-1}return r||=U(H,i,1),{firstDay:n,minimalDays:r}})}function G(e){return e===`''`?`'`:e.slice(1,-1).replace(/''/g,`'`)}function K(e){switch(e){case 5:return`narrow`;case 4:return`long`;default:return`short`}}function ne(e,t,n,r,i){let a=M(r),o=!0;return e===a?(i||t===a)&&(e=M(r,n)):o=!1,{numeric:o,source:e}}function q(e){return W(e).minimalDays}function J(e,t){return(7+parseInt(t,10)-W(e).firstDay%7)%7+1}function Y(e,t,n=`long`,r=!0){let i=O(e,n,r).indexOf(t);if(i===-1)throw Error(`Unmatched day string in DateTime string: ${t}`);return J(e,i)}function re(e,t,n=`long`){return D(e,n).indexOf(t)}function ie(e,t,n=`long`){return k(e,n).indexOf(t)}function X(e,t,n=`long`,r=!0){return A(e,n,r).indexOf(t)+1}function Z(e,t){let n=j(e);return Array.from(t,e=>n.indexOf(e)).join(``)}function Q(e,t){return parseInt(Z(e,t),10)}var $={G:{key:`era`,regex:(e,t)=>y(k(e,K(t))),input:(e,t,n)=>ie(e,t,K(n)),output:(e,t)=>{let n=K(t);return e.era(n)}},y:{key:`year`,regex:e=>M(e),input:(e,t,n)=>(t=Q(e,t),n!==2||`${t}`.length!==2?t:t>40?1900+t:2e3+t),output:(e,t)=>{let n=e.getYear();return t===2&&(n=`${n}`.slice(-2)),L(e.getLocale(),Math.abs(n),t)}},Y:{key:`weekYear`,regex:e=>M(e),input:(e,t,n)=>(t=Q(e,t),n!==2||`${t}`.length!==2?t:t>40?1900+t:2e3+t),output:(e,t)=>{let n=e.getWeekYear();return t===2&&(n=`${n}`.slice(-2)),L(e.getLocale(),Math.abs(n),t)}},Q:{key:`quarter`,supportsLength:e=>e!==3&&e!==4,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getQuarter(),t<3?t:0)},q:{key:`quarter`,supportsLength:e=>e!==3&&e!==4,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getQuarter(),t<3?t:0)},M:{key:`month`,supportsLength:(e,t)=>!t||e!==5,regex:(e,t)=>{switch(t){case 5:case 4:case 3:return y(A(e,K(t),!1));default:return M(e)}},input:(e,t,n)=>{switch(n){case 4:case 3:return X(e,t,K(n),!1);default:return Q(e,t)}},output:(e,t)=>{let n=e.getLocale(),r=e.getMonth();switch(t){case 5:case 4:case 3:return I(n,r,K(t),!1);default:return L(n,r,t)}}},L:{key:`month`,supportsLength:(e,t)=>!t||e!==5,regex:(e,t)=>{switch(t){case 5:case 4:case 3:return y(A(e,K(t)));default:return M(e)}},input:(e,t,n)=>{switch(n){case 4:case 3:return X(e,t,K(n));default:return Q(e,t)}},output:(e,t)=>{let n=e.getLocale(),r=e.getMonth();switch(t){case 5:case 4:case 3:return I(n,r,K(t));default:return L(n,r,t)}}},w:{key:`week`,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getWeek(),t)},W:{key:`weekOfMonth`,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getWeekOfMonth(),t)},d:{key:`date`,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getDate(),t)},D:{key:`dayOfYear`,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getDayOfYear(),t)},F:{key:`weekDayInMonth`,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getWeekDayInMonth(),t)},E:{key:`weekDay`,supportsLength:(e,t)=>e!==6&&(!t||e!==5),regex:(e,t)=>y(O(e,K(t),!1)),input:(e,t,n)=>Y(e,t,K(n),!1),output:(e,t)=>{let n=K(t);return N(e.getLocale(),e.getDay(),n,!1)}},e:{key:`weekDay`,supportsLength:(e,t)=>e!==6&&(!t||e!==5),regex:(e,t)=>t<3?M(e):y(O(e,K(t),!1)),input:(e,t,n)=>n<3?Q(e,t):Y(e,t,K(n),!1),output:(e,t)=>{let n=e.getLocale();if(t<3)return L(n,e.getWeekDay(),t);let r=K(t);return N(n,e.getDay(),r,!1)}},c:{key:`weekDay`,supportsLength:(e,t)=>e!==6&&(!t||e!==5),regex:(e,t)=>t<3?M(e):y(O(e,K(t))),input:(e,t,n)=>n<3?Q(e,t):Y(e,t,K(n)),output:(e,t)=>{let n=e.getLocale();if(t<3)return L(n,e.getWeekDay());let r=K(t);return N(n,e.getDay(),r)}},a:{key:`dayPeriod`,supportsLength:e=>e<=4,regex:(e,t)=>y(D(e,K(t))),input:(e,t,n)=>re(e,t,K(n)),output:(e,t)=>{let n=K(t);return e.dayPeriod(n)}},h:{key:`hours12`,regex:e=>M(e),input:(e,t)=>(t=Q(e,t),t===12&&(t=0),t),output:(e,t)=>L(e.getLocale(),e.getHours()%12||12,t)},H:{key:`hours24`,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getHours(),t)},K:{key:`hours12`,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getHours()%12,t)},k:{key:`hours24`,regex:e=>M(e),input:(e,t)=>(t=Q(e,t),t===24&&(t=0),t),output:(e,t)=>L(e.getLocale(),e.getHours()||24,t)},m:{key:`minutes`,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getMinutes(),t)},s:{key:`seconds`,regex:e=>M(e),input:(e,t)=>Q(e,t),output:(e,t)=>L(e.getLocale(),e.getSeconds(),t)},S:{key:`milliseconds`,regex:e=>M(e),input:(e,t)=>parseInt(Z(e,t).padEnd(3,`0`).slice(0,3),10),output:(e,t)=>{let n=`${e.getMilliseconds()}`.padStart(3,`0`);return L(e.getLocale(),n.padEnd(t,`0`).slice(0,t))}},z:{supportsLength:(e,t)=>!t,output:(e,t)=>{let n=K(Math.min(t,4));return e.timeZoneName(n)}},Z:{key:`timeZone`,regex:(e,t)=>t===5?`[\\+\\-]\\d{2}\\:\\d{2}(?:\\:\\d{2})?|Z`:t>=4?`GMT[\\+\\-]\\d{2}\\:\\d{2}|GMT`:`[\\+\\-]\\d{4}`,input:(e,t)=>t,output:(e,t)=>{let n=e.getTimeZoneOffset(),r=!0,i=``;if(t===5){if(!n)return`Z`}else if(t>=4){if(i=`GMT`,!n)return i}else r=!1;return i+R(n,r,!1,t===5)}},O:{key:`timeZone`,supportsLength:e=>e===1||e===4,regex:(e,t)=>{switch(t){case 4:return`GMT[\\+\\-]\\d{2}\\:\\d{2}|GMT`;default:return`GMT[\\+\\-]\\d{2}|GMT`}},input:(e,t)=>t,output:(e,t)=>{let n=e.getTimeZoneOffset();if(!n)return`GMT`;let r=!1;switch(t){case 4:break;default:r=!0}return`GMT`+R(n,!0,r)}},V:{key:`timeZone`,supportsLength:e=>e===2,regex:e=>`([A-Za-z0-9_.+\\-/]+)`,input:(e,t)=>t,output:e=>e.getTimeZone()},X:{key:`timeZone`,supportsLength:e=>e<=5,regex:(e,t)=>{switch(t){case 5:return`[\\+\\-]\\d{2}\\:\\d{2}(?:\\:\\d{2})?|Z`;case 4:return`[\\+\\-]\\d{4}(?:\\d{2})?|Z`;case 3:return`[\\+\\-]\\d{2}\\:\\d{2}|Z`;case 2:return`[\\+\\-]\\d{4}|Z`;default:return`[\\+\\-]\\d{2}(?:\\d{2})?|Z`}},input:(e,t)=>t,output:(e,t)=>{let n=e.getTimeZoneOffset();if(!n)return`Z`;let r;switch(t){case 5:case 3:r=!0;break;default:r=!1}return R(n,r,t===1,t>=4)}},x:{key:`timeZone`,supportsLength:e=>e<=5,regex:(e,t)=>{switch(t){case 5:return`[\\+\\-]\\d{2}\\:\\d{2}(?:\\:\\d{2})?`;case 4:return`[\\+\\-]\\d{4}(?:\\d{2})?`;case 3:return`[\\+\\-]\\d{2}\\:\\d{2}`;case 2:return`[\\+\\-]\\d{4}`;default:return`[\\+\\-]\\d{2}(?:\\d{2})?`}},input:(e,t)=>t,output:(e,t)=>{let n;switch(t){case 5:case 3:n=!0;break;default:n=!1}return R(e.getTimeZoneOffset(),n,t===1,t>=4)}}};return class{#e;#t;#n;#r;#i;static clearDataCache(){t()}static dayOfYear(e,t,n){return Array(t-1).fill().reduce((t,n,r)=>t+this.daysInMonth(e,r+1),n)}static daysInMonth(e,t){let n=new Date(0);return n.setUTCFullYear(e,t-1,1),t=n.getUTCMonth(),d[t]+(t===1&&this.isLeapYear(n.getUTCFullYear())?1:0)}static daysInYear(e){return this.isLeapYear(e)?366:365}static fromArray(e,t={}){let n=e.slice(0,3),r=e.slice(3);return n.length<3&&n.push(...Array(3-n.length).fill(1)),r.length<4&&r.push(...Array(4-r.length).fill(0)),new this(null,t).withTimestamp(0).withYear(...n).withHours(...r)}static fromDate(e,t={}){return new this(e.getTime(),t)}static fromFormat(e,t,n={}){let r=`locale`in n?n.locale:s.defaultLocale,i=`timeZone`in n?n.timeZone:s.defaultTimeZone,a=[],o,c=!1;for(;e&&(o=e.match(u));){let n=o[1],i=o.index,s=o[0].length;if(i&&C(e.substring(0,i),t),e=e.substring(i+s),t=t.substring(i),!n){let e=G(o[0]);C(e,t),t=t.substring(e.length),c=!1;continue}if(!(n in $))throw Error(`Invalid token in DateTime format: ${n}`);if($[n].supportsLength?.(s,!0)===!1)throw Error(`Unsupported parsing token in DateTime format: ${n.repeat(s)}`);let l=c&&!i,u=null;if(!l){let t=e[0];if(t&&t in $){let n=e.match(/^(.)\1*/)[0].length;u=$[t].regex(r,n)}}let{numeric:d,source:f}=ne($[n].regex(r,s),u,s,r,l),p=t.match(RegExp(`^${f}`));if(!p)throw Error(`Unmatched token in DateTime string: ${n}`);let m=p[0],h=$[n].input(r,m,s);if(h!==null){let e=$[n].key;a.push({key:e,value:h,literal:m,token:n,length:s})}t=t.substring(m.length),c=d}if(e&&(C(e,t),t=t.substring(e.length)),t)throw Error(`Unmatched trailing characters in DateTime string: ${t}`);let l=i;for(let{key:e,value:t}of a)e===`timeZone`&&(l=t);let d=this.fromArray([1970,1,1],{locale:r,timeZone:l}),f=T(),m=[];for(let e of p)for(let t of e)if(!(t===`era`&&!a.find(e=>e.key===`year`)))for(let e of a){let{key:n,value:r}=e;n===t&&(d=f[n].set(d,r),m.push(e))}let h=!0;for(let{key:e,value:t}of m)if(e in f&&f[e].get(d)!==t){h=!1;break}return i!==l&&(d=d.withTimeZone(i)),d.isValid=h,d}static fromISOString(e,t={}){let n=this.fromFormat(l.rfc3339_extended,e,{locale:`en`});return`timeZone`in t&&(n=n.withTimeZone(t.timeZone)),`locale`in t&&(n=n.withLocale(t.locale)),n}static fromTimestamp(e,t={}){return new this(null,t).withTimestamp(e)}static getDefaultLocale(){return s.defaultLocale}static getDefaultTimeZone(){return s.defaultTimeZone}static isLeapYear(e){let t=new Date(0);return t.setUTCFullYear(e,1,29),t.getUTCDate()===29}static now(e={}){return new this(null,e)}static setDateClamping(e){s.clampDates=e}static setDefaultLocale(e){s.defaultLocale=e}static setDefaultTimeZone(e){s.defaultTimeZone=e}constructor(e=null,t={}){let n,r=!1;if(e===null)n=Date.now();else if(typeof e==`number`&&Number.isFinite(e))n=e;else if(e===`${e}`){if(n=Date.parse(e),isNaN(n))throw Error(`Invalid date string supplied`);if(r=!c.test(e),r){let t=w(e);t===null?n-=new Date(n).getTimezoneOffset()*6e4:n=t}}else throw Error(`Invalid date supplied`);this.#e=new Date(n),this.#t=!1,this.isValid=!0;let i=t.timeZone;i||=s.defaultTimeZone,[`Z`,`GMT`].includes(i)&&(i=`UTC`);let a=i.match(f);if(a?(this.#r=a[2]*60+parseInt(a[4]||0,10)+parseInt(a[5]||0,10)/60,this.#r&&a[1]===`+`&&(this.#r*=-1),this.#r?this.#i=R(this.#r):(this.#t=!0,this.#i=`UTC`)):(this.#t=!0,this.#i=i),this.#n=`locale`in t?t.locale:s.defaultLocale,this.#t&&(this.#r=ee(this)),r&&this.#r){let e=E(this,n);this.#e.setTime(e.getTime()),this.#r=e.getTimeZoneOffset()}}addDay(){return this.addDays(1)}addDays(e){return E(this,new Date(S(this)).setUTCDate(this.getDate()+e),e)}addHour(){return this.addHours(1)}addHours(e){return this.withTime(this.getTime()+e*36e5)}addMinute(){return this.addMinutes(1)}addMinutes(e){return this.withTime(this.getTime()+e*6e4)}addMonth(){return this.addMonths(1)}addMonths(e){return this.withMonth(this.getMonth()+e)}addSecond(){return this.addSeconds(1)}addSeconds(e){return this.withTime(this.getTime()+e*1e3)}addWeek(){return this.addWeeks(1)}addWeeks(e){return this.withDate(this.getDate()+e*7)}addYear(){return this.addYears(1)}addYears(e){return this.withYear(this.getYear()+e)}dayName(e=`long`){return N(this.getLocale(),this.getDay(),e)}dayPeriod(e=`long`){return P(this.getLocale(),this.getHours()<12?0:1,e)}daysInMonth(){return this.constructor.daysInMonth(this.getYear(),this.getMonth())}daysInYear(){return this.constructor.daysInYear(this.getYear())}diff(e){return this-e}diffInDays(e,{relative:t=!0}={}){return v(this,e,`day`,t)}diffInHours(e,{relative:t=!0}={}){return v(this,e,`hour`,t)}diffInMinutes(e,{relative:t=!0}={}){return v(this,e,`minute`,t)}diffInMonths(e,{relative:t=!0}={}){return v(this,e,`month`,t)}diffInSeconds(e,{relative:t=!0}={}){return v(this,e,`second`,t)}diffInWeeks(e,{relative:t=!0}={}){return v(this,e,`week`,t)}diffInYears(e,{relative:t=!0}={}){return v(this,e,`year`,t)}endOfDay(){return this.withHours(23,59,59,999)}endOfHour(){return this.withMinutes(59,59,999)}endOfMinute(){return this.withSeconds(59,999)}endOfMonth(){return this.withDate(this.daysInMonth()).endOfDay()}endOfQuarter(){let e=this.getQuarter()*3;return this.withMonth(e,this.constructor.daysInMonth(this.getYear(),e)).endOfDay()}endOfSecond(){return this.withMilliseconds(999)}endOfWeek(){return this.withWeekDay(7).endOfDay()}endOfYear(){return this.withMonth(12,31).endOfDay()}era(e=`long`){return F(this.getLocale(),this.getYear()<0?0:1,e)}format(e){let t,n=``;for(;e&&(t=e.match(u));){let r=t[1],i=t.index,a=t[0].length;if(i&&(n+=e.substring(0,i)),e=e.substring(i+a),!r){n+=G(t[0]);continue}if(!(r in $))throw Error(`Invalid token in DateTime format: ${r}`);if($[r].supportsLength?.(a)===!1)throw Error(`Unsupported token in DateTime format: ${r.repeat(a)}`);n+=$[r].output(this,a)}return n+=e,n}getDate(){return new Date(S(this)).getUTCDate()}getDay(){return new Date(S(this)).getUTCDay()}getDayOfYear(){return this.constructor.dayOfYear(this.getYear(),this.getMonth(),this.getDate())}getHours(){return new Date(S(this)).getUTCHours()}getLocale(){return this.#n}getMilliseconds(){return new Date(S(this)).getUTCMilliseconds()}getMinutes(){return new Date(S(this)).getUTCMinutes()}getMonth(){return new Date(S(this)).getUTCMonth()+1}getQuarter(){return Math.ceil(this.getMonth()/3)}getSeconds(){return new Date(S(this)).getUTCSeconds()}getTime(){return this.#e.getTime()}getTimestamp(){return Math.floor(this.getTime()/1e3)}getTimeZone(){return this.#i}getTimeZoneOffset(){return this.#r}getWeek(){let e=this.startOfDay().withWeekDay(1),t=e.withWeek(1,1);return 1+Math.floor((S(e)-S(t))/6048e5)}getWeekDay(){return J(this.getLocale(),this.getDay())}getWeekDayInMonth(){let e=this.getWeek(),t=this.withDate(1),n=t.getWeek(),r=t.getWeekDay()>this.getWeekDay()?0:1;return n>e?e+r:e-n+r}getWeekOfMonth(){let e=this.getWeek(),t=this.withDate(1).getWeek();return t>e?e+1:e-t+1}getWeekYear(){let e=q(this.getLocale());return this.withWeekDay(7-e+1).getYear()}getYear(){return new Date(S(this)).getUTCFullYear()}humanDiff(e){let[t,n]=x(this,e);return z(this.getLocale(),t,n)}humanDiffInDays(e){return z(this.getLocale(),this.diffInDays(e),`day`)}humanDiffInHours(e){return z(this.getLocale(),this.diffInHours(e),`hour`)}humanDiffInMinutes(e){return z(this.getLocale(),this.diffInMinutes(e),`minute`)}humanDiffInMonths(e){return z(this.getLocale(),this.diffInMonths(e),`month`)}humanDiffInSeconds(e){return z(this.getLocale(),this.diffInSeconds(e),`second`)}humanDiffInWeeks(e){return z(this.getLocale(),this.diffInWeeks(e),`week`)}humanDiffInYears(e){return z(this.getLocale(),this.diffInYears(e),`year`)}isAfter(e){return this.diff(e)>0}isAfterDay(e){return this.diffInDays(e)>0}isAfterHour(e){return this.diffInHours(e)>0}isAfterMinute(e){return this.diffInMinutes(e)>0}isAfterMonth(e){return this.diffInMonths(e)>0}isAfterSecond(e){return this.diffInSeconds(e)>0}isAfterWeek(e){return this.diffInWeeks(e)>0}isAfterYear(e){return this.diffInYears(e)>0}isBefore(e){return this.diff(e)<0}isBeforeDay(e){return this.diffInDays(e)<0}isBeforeHour(e){return this.diffInHours(e)<0}isBeforeMinute(e){return this.diffInMinutes(e)<0}isBeforeMonth(e){return this.diffInMonths(e)<0}isBeforeSecond(e){return this.diffInSeconds(e)<0}isBeforeWeek(e){return this.diffInWeeks(e)<0}isBeforeYear(e){return this.diffInYears(e)<0}isBetween(e,t){return this.isAfter(e)&&this.isBefore(t)}isBetweenDay(e,t){return this.isAfterDay(e)&&this.isBeforeDay(t)}isBetweenHour(e,t){return this.isAfterHour(e)&&this.isBeforeHour(t)}isBetweenMinute(e,t){return this.isAfterMinute(e)&&this.isBeforeMinute(t)}isBetweenMonth(e,t){return this.isAfterMonth(e)&&this.isBeforeMonth(t)}isBetweenSecond(e,t){return this.isAfterSecond(e)&&this.isBeforeSecond(t)}isBetweenWeek(e,t){return this.isAfterWeek(e)&&this.isBeforeWeek(t)}isBetweenYear(e,t){return this.isAfterYear(e)&&this.isBeforeYear(t)}isDst(){if(!this.#t)return!1;let e=this.getYear(),t=this.constructor.fromArray([e,1,1],{timeZone:this.getTimeZone()}),n=this.constructor.fromArray([e,6,1],{timeZone:this.getTimeZone()});return this.getTimeZoneOffset()<Math.max(t.getTimeZoneOffset(),n.getTimeZoneOffset())}isLeapYear(){return this.constructor.isLeapYear(this.getYear())}isSame(e){return this.diff(e)===0}isSameDay(e){return this.diffInDays(e)===0}isSameHour(e){return this.diffInHours(e)===0}isSameMinute(e){return this.diffInMinutes(e)===0}isSameMonth(e){return this.diffInMonths(e)===0}isSameOrAfter(e){return this.diff(e)>=0}isSameOrAfterDay(e){return this.diffInDays(e)>=0}isSameOrAfterHour(e){return this.diffInHours(e)>=0}isSameOrAfterMinute(e){return this.diffInMinutes(e)>=0}isSameOrAfterMonth(e){return this.diffInMonths(e)>=0}isSameOrAfterSecond(e){return this.diffInSeconds(e)>=0}isSameOrAfterWeek(e){return this.diffInWeeks(e)>=0}isSameOrAfterYear(e){return this.diffInYears(e)>=0}isSameOrBefore(e){return this.diff(e)<=0}isSameOrBeforeDay(e){return this.diffInDays(e)<=0}isSameOrBeforeHour(e){return this.diffInHours(e)<=0}isSameOrBeforeMinute(e){return this.diffInMinutes(e)<=0}isSameOrBeforeMonth(e){return this.diffInMonths(e)<=0}isSameOrBeforeSecond(e){return this.diffInSeconds(e)<=0}isSameOrBeforeWeek(e){return this.diffInWeeks(e)<=0}isSameOrBeforeYear(e){return this.diffInYears(e)<=0}isSameSecond(e){return this.diffInSeconds(e)===0}isSameWeek(e){return this.diffInWeeks(e)===0}isSameYear(e){return this.diffInYears(e)===0}monthName(e=`long`){return I(this.getLocale(),this.getMonth(),e)}startOfDay(){return this.withHours(0,0,0,0)}startOfHour(){return this.withMinutes(0,0,0)}startOfMinute(){return this.withSeconds(0,0)}startOfMonth(){return this.withDate(1).startOfDay()}startOfQuarter(){let e=this.getQuarter()*3-2;return this.withMonth(e,1).startOfDay()}startOfSecond(){return this.withMilliseconds(0)}startOfWeek(){return this.withWeekDay(1).startOfDay()}startOfYear(){return this.withMonth(1,1).startOfDay()}subDay(){return this.addDays(-1)}subDays(e){return this.addDays(-e)}subHour(){return this.addHours(-1)}subHours(e){return this.addHours(-e)}subMinute(){return this.addMinutes(-1)}subMinutes(e){return this.addMinutes(-e)}subMonth(){return this.addMonths(-1)}subMonths(e){return this.addMonths(-e)}subSecond(){return this.addSeconds(-1)}subSeconds(e){return this.addSeconds(-e)}subWeek(){return this.addWeeks(-1)}subWeeks(e){return this.addWeeks(-e)}subYear(){return this.addYears(-1)}subYears(e){return this.addYears(-e)}[Symbol.toPrimitive](e){return e===`number`?this.valueOf():this.toString()}timeZoneName(e=`long`){return this.#t?B(this.getLocale(),this.getTime(),this.getTimeZone(),e):`GMT`+R(this.getTimeZoneOffset(),!0,e===`short`)}toDateString(){return this.format(l.date)}toIsoString(){return this.withLocale(`en`).withTimeZone(`UTC`).format(l.rfc3339_extended)}toJSON(){return this.isValid?this.toIsoString():null}toString(){return this.format(l.string)}toTimeString(){return this.format(l.time)}toUTCString(){return this.withLocale(`en`).withTimeZone(`UTC`).toString()}valueOf(){return this.getTime()}weeksInYear(){let e=q(this.getLocale());return this.withMonth(12,24+e).getWeek()}withDate(e){return E(this,new Date(S(this)).setUTCDate(e))}withDay(e){return E(this,new Date(S(this)).setUTCDate(this.getDate()-this.getDay()+parseInt(e,10)))}withDayOfYear(e){return E(this,new Date(S(this)).setUTCMonth(0,e))}withHours(...e){return E(this,new Date(S(this)).setUTCHours(...e))}withLocale(e){return new this.constructor(this.getTime(),{locale:e,timeZone:this.#i})}withMilliseconds(e){return E(this,new Date(S(this)).setUTCMilliseconds(e))}withMinutes(...e){return E(this,new Date(S(this)).setUTCMinutes(...e))}withMonth(e,t=null){return t===null&&(t=this.getDate(),s.clampDates&&(t=Math.min(t,this.constructor.daysInMonth(this.getYear(),e)))),E(this,new Date(S(this)).setUTCMonth(e-1,t))}withQuarter(e){return E(this,new Date(S(this)).setUTCMonth(e*3-3))}withSeconds(...e){return E(this,new Date(S(this)).setUTCSeconds(...e))}withTime(e){return new this.constructor(e,{locale:this.#n,timeZone:this.#i})}withTimestamp(e){return this.withTime(e*1e3)}withTimeZone(e){return new this.constructor(this.getTime(),{locale:this.#n,timeZone:e})}withTimeZoneOffset(e){return new this.constructor(this.getTime(),{locale:this.#n,timeZone:R(e)})}withWeek(e,t=null){t===null&&(t=this.getWeekDay());let n=q(this.getLocale());return this.withYear(this.getWeekYear(),1,n+(e-1)*7).withWeekDay(t)}withWeekDay(e){return E(this,new Date(S(this)).setUTCDate(this.getDate()-this.getWeekDay()+parseInt(e,10)))}withWeekDayInMonth(e){return this.withDate(this.getDate()+(e-this.getWeekDayInMonth())*7)}withWeekOfMonth(e){return this.withDate(this.getDate()+(e-this.getWeekOfMonth())*7)}withWeekYear(e,t=null,n=null){let r=q(this.getLocale()),i=this.constructor;return t===null&&(t=Math.min(this.getWeek(),i.fromArray([e,1,r],{locale:this.getLocale(),timeZone:this.getTimeZone()}).weeksInYear())),n===null&&(n=this.getWeekDay()),this.withYear(e,1,r+(t-1)*7).withWeekDay(n)}withYear(e,t=null,n=null){return t===null&&(t=this.getMonth()),n===null&&(n=this.getDate(),s.clampDates&&(n=Math.min(n,this.constructor.daysInMonth(e,t)))),E(this,new Date(S(this)).setUTCFullYear(e,t-1,n))}}});
|
|
2
2
|
//# sourceMappingURL=frost-datetime.min.js.map
|