date-and-time 4.1.1 → 4.2.0
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/dist/index.cjs +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +1 -1
- package/dist/numerals/arab.cjs +1 -1
- package/dist/numerals/arab.js +1 -1
- package/dist/numerals/arabext.cjs +1 -1
- package/dist/numerals/arabext.js +1 -1
- package/dist/numerals/beng.cjs +1 -1
- package/dist/numerals/beng.js +1 -1
- package/dist/numerals/mymr.cjs +1 -1
- package/dist/numerals/mymr.js +1 -1
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.d.ts +7 -7
- package/dist/plugin.js +1 -1
- package/dist/plugins/day-of-week.d.ts +1 -1
- package/dist/plugins/microsecond.cjs +1 -1
- package/dist/plugins/microsecond.d.ts +1 -1
- package/dist/plugins/microsecond.js +1 -1
- package/dist/plugins/nanosecond.cjs +1 -1
- package/dist/plugins/nanosecond.d.ts +1 -1
- package/dist/plugins/nanosecond.js +1 -1
- package/dist/plugins/ordinal.cjs +1 -1
- package/dist/plugins/ordinal.d.ts +7 -7
- package/dist/plugins/ordinal.js +1 -1
- package/dist/plugins/two-digit-year.cjs +1 -1
- package/dist/plugins/two-digit-year.d.ts +1 -1
- package/dist/plugins/two-digit-year.js +1 -1
- package/dist/plugins/zonename.cjs +1 -1
- package/dist/plugins/zonename.d.ts +6 -6
- package/dist/plugins/zonename.js +1 -1
- package/dist/timezone.cjs +1 -0
- package/dist/timezone.d.ts +425 -0
- package/dist/timezone.js +1 -0
- package/package.json +20 -12
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/** @preserve Copyright (c) KNOWLEDGECODE - MIT License */const e=/\\\[/g,t=/\\\]/g,r=/\uE000/g,n=/\uE001/g,s=/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g,o=o=>{const a=o.replace(e,"").replace(t,"").match(s)||[];return[o,...a.map(e=>e.replace(r,"[").replace(n,"]"))]},a=new Map,i=e=>a.get(e)||(()=>{const t=new Intl.DateTimeFormat("en-US",{hour12:!1,weekday:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZone:e});return e&&a.set(e,t),t})(),c=(e,t)=>{if("UTC"===t?.toUpperCase())return{weekday:e.getUTCDay(),year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds(),fractionalSecond:e.getUTCMilliseconds(),timezoneOffset:0};const r=i(t).formatToParts(e).reduce((e,{type:t,value:r})=>{switch(t){case"weekday":e[t]="SunMonTueWedThuFriSat".indexOf(r)/3;break;case"hour":e[t]=+r%24;break;case"year":case"month":case"day":case"minute":case"second":case"fractionalSecond":e[t]=+r}return e},{weekday:4,year:1970,month:1,day:1,hour:0,minute:0,second:0,fractionalSecond:0,timezoneOffset:0});return r.timezoneOffset=(e.getTime()-Date.UTC(r.year,r.month-(r.year<100?22801:1),r.day,r.hour,r.minute,r.second,r.fractionalSecond))/6e4,r},u=e=>Date.UTC(e.year,e.month-(e.year<100?22801:1),e.day,e.hour,e.minute,e.second,e.fractionalSecond+6e4*e.timezoneOffset);class l{constructor(e,t){this.parts=c(e,t),this.time=e.getTime()}getFullYear(){return this.parts.year}getMonth(){return this.parts.month-1}getDate(){return this.parts.day}getHours(){return this.parts.hour}getMinutes(){return this.parts.minute}getSeconds(){return this.parts.second}getMilliseconds(){return this.parts.fractionalSecond}getDay(){return this.parts.weekday}getTime(){return this.time}getTimezoneOffset(){return this.parts.timezoneOffset}}class d{}const h=(e,t)=>e.getFullYear()+("buddhist"===t?543:0);const m=new class extends d{YYYY(e,t){return`000${h(e,t.calendar)}`.slice(-4)}YY(e,t){return`0${h(e,t.calendar)}`.slice(-2)}Y(e,t){return`${h(e,t.calendar)}`}MMMM(e,t,r){return t.locale.getMonthList({style:"long",compiledObj:r})[e.getMonth()]||""}MMM(e,t,r){return t.locale.getMonthList({style:"short",compiledObj:r})[e.getMonth()]||""}MM(e){return`0${e.getMonth()+1}`.slice(-2)}M(e){return`${e.getMonth()+1}`}DD(e){return`0${e.getDate()}`.slice(-2)}D(e){return`${e.getDate()}`}HH(e,t){return`0${e.getHours()||("h24"===t.hour24?24:0)}`.slice(-2)}H(e,t){return`${e.getHours()||("h24"===t.hour24?24:0)}`}AA(e,t,r){return t.locale.getMeridiemList({style:"long",compiledObj:r,case:"uppercase"})[+(e.getHours()>11)]||""}A(e,t,r){return t.locale.getMeridiemList({style:"short",compiledObj:r,case:"uppercase"})[+(e.getHours()>11)]||""}aa(e,t,r){return t.locale.getMeridiemList({style:"long",compiledObj:r,case:"lowercase"})[+(e.getHours()>11)]||""}a(e,t,r){return t.locale.getMeridiemList({style:"short",compiledObj:r,case:"lowercase"})[+(e.getHours()>11)]||""}hh(e,t){return`0${e.getHours()%12||("h12"===t.hour12?12:0)}`.slice(-2)}h(e,t){return`${e.getHours()%12||("h12"===t.hour12?12:0)}`}mm(e){return`0${e.getMinutes()}`.slice(-2)}m(e){return`${e.getMinutes()}`}ss(e){return`0${e.getSeconds()}`.slice(-2)}s(e){return`${e.getSeconds()}`}SSS(e){return`00${e.getMilliseconds()}`.slice(-3)}SS(e){return`00${e.getMilliseconds()}`.slice(-3,-1)}S(e){return`00${e.getMilliseconds()}`.slice(-3,-2)}dddd(e,t,r){return t.locale.getDayOfWeekList({style:"long",compiledObj:r})[e.getDay()]||""}ddd(e,t,r){return t.locale.getDayOfWeekList({style:"short",compiledObj:r})[e.getDay()]||""}dd(e,t,r){return t.locale.getDayOfWeekList({style:"narrow",compiledObj:r})[e.getDay()]||""}Z(e){const t=e.getTimezoneOffset(),r=Math.abs(t);return`${t>0?"-":"+"}${("0"+(r/60|0)).slice(-2)}${("0"+r%60).slice(-2)}`}ZZ(e){const t=e.getTimezoneOffset(),r=Math.abs(t);return`${t>0?"-":"+"}${("0"+(r/60|0)).slice(-2)}:${("0"+r%60).slice(-2)}`}},g={MMMM:["January","February","March","April","May","June","July","August","September","October","November","December"],MMM:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dd:["Su","Mo","Tu","We","Th","Fr","Sa"],A:["AM","PM"],AA:["A.M.","P.M."],a:["am","pm"],aa:["a.m.","p.m."]};var M=new class{getLocale(){return"en"}getMonthList(e){return"long"===e.style?g.MMMM:g.MMM}getDayOfWeekList(e){return"long"===e.style?g.dddd:"short"===e.style?g.ddd:g.dd}getMeridiemList(e){return"long"===e.style?"lowercase"===e.case?g.aa:g.AA:"lowercase"===e.case?g.a:g.A}},f={encode:e=>e,decode:e=>e};const p=e=>"object"==typeof e&&"zone_name"in e&&"gmt_offset"in e,y=e=>"UTC"===e,D=(e,t)=>{const r=i("UTC"),n=i(t.zone_name),s=t.gmt_offset;for(let t=0;t<2;t++){const o=r.format(e-86400*t*1e3);for(let r=0,a=s.length;r<a;r++)if(n.format(e-1e3*(s[r]+86400*t))===o)return s[r]}return NaN},T=/^\[(.*)\]$/;function L(e,t,r){const n=("string"==typeof t?o(t):t).slice(1),s=p(r?.timeZone)||y(r?.timeZone)?r.timeZone:void 0,a="string"==typeof s?s:s?.zone_name||"",i=a?new l(e,a):e,c={hour12:r?.hour12||"h12",hour24:r?.hour24||"h23",numeral:r?.numeral||f,calendar:r?.calendar||"gregory",timeZone:s,locale:r?.locale||M},u=[...r?.plugins||[],m],d=c.numeral.encode;return n.reduce((e,t)=>e+((e,t)=>{for(const r of u)if(r[e])return d(r[e](i,c,t));return T.test(e)?e.replace(T,"$1"):e})(t,n),"")}class S{}const C=(e,t,r)=>{const n=e.exec(t)?.[0]||"";return{value:+n,length:n.length,token:r}},w=(e,t,r)=>e.reduce((e,n,s)=>n.length>e.length&&!t.indexOf(n)?{value:s,length:n.length,token:r}:e,{value:-1,length:0,token:r});const b=new class extends S{YYYY(e){return C(/^\d{4}/,e,"Y")}Y(e){return C(/^\d{1,4}/,e,"Y")}MMMM(e,t,r){const n=t.locale.getMonthList({style:"long",compiledObj:r}),s=t.locale.getLocale(),o=t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"M"):w(n,e,"M");return o.value++,o}MMM(e,t,r){const n=t.locale.getMonthList({style:"short",compiledObj:r}),s=t.locale.getLocale(),o=t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"M"):w(n,e,"M");return o.value++,o}MM(e){return C(/^\d\d/,e,"M")}M(e){return C(/^\d\d?/,e,"M")}DD(e){return C(/^\d\d/,e,"D")}D(e){return C(/^\d\d?/,e,"D")}HH(e){return C(/^\d\d/,e,"H")}H(e){return C(/^\d\d?/,e,"H")}AA(e,t,r){const n=t.locale.getMeridiemList({style:"long",compiledObj:r,case:"uppercase"}),s=t.locale.getLocale();return t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(n,e,"A")}A(e,t,r){const n=t.locale.getMeridiemList({style:"short",compiledObj:r,case:"uppercase"}),s=t.locale.getLocale();return t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(n,e,"A")}aa(e,t,r){const n=t.locale.getMeridiemList({style:"long",compiledObj:r,case:"lowercase"}),s=t.locale.getLocale();return t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(n,e,"A")}a(e,t,r){const n=t.locale.getMeridiemList({style:"short",compiledObj:r,case:"lowercase"}),s=t.locale.getLocale();return t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(n,e,"A")}hh(e){return C(/^\d\d/,e,"h")}h(e){return C(/^\d\d?/,e,"h")}mm(e){return C(/^\d\d/,e,"m")}m(e){return C(/^\d\d?/,e,"m")}ss(e){return C(/^\d\d/,e,"s")}s(e){return C(/^\d\d?/,e,"s")}SSS(e){return C(/^\d{1,3}/,e,"S")}SS(e){const t=C(/^\d\d?/,e,"S");return t.value*=10,t}S(e){const t=C(/^\d/,e,"S");return t.value*=100,t}Z(e){const t=C(/^[+-][01]\d[0-5]\d/,e,"Z");return t.value=-60*(t.value/100|0)-t.value%100,t}ZZ(e){const t=/^([+-][01]\d):([0-5]\d)/.exec(e)||["","",""],r=+(t[1]+t[2]);return{value:-60*(r/100|0)-r%100,length:t[0].length,token:"Z"}}},O=/^\[(.*)\]$/;function $(e,t,r){const n=("string"==typeof t?o(t):t).slice(1),s={hour12:r?.hour12||"h12",hour24:r?.hour24||"h23",numeral:r?.numeral||f,calendar:r?.calendar||"gregory",ignoreCase:r?.ignoreCase||!1,timeZone:p(r?.timeZone)||y(r?.timeZone)?r.timeZone:void 0,locale:r?.locale||M},a={_index:0,_length:0,_match:0},i=[...r?.plugins||[],b],c=(e,t)=>{for(const r of i)if(r[e])return r[e](t,s,n)};e=s.numeral.decode(e);for(const t of n){const r=e.substring(a._index),n=c(t,r);if(n){if(!n.length)break;n.token&&(a[n.token]=n.value+0),a._index+=n.length,a._match++}else if(t===r[0]||" "===t)a._index++;else{if(!O.test(t)||r.indexOf(t.replace(O,"$1"))){if("..."===t){a._index=e.length;break}break}a._index+=t.length-2}}return a._length=e.length,a}function x(e,t){const r=void 0===e.Y?1970:e.Y-("buddhist"===t?.calendar?543:0),[n,s]="h11"===t?.hour12?[0,11]:[1,12],[o,a]="h24"===t?.hour24?[1,24]:[0,23],i=(e,t,r)=>void 0===e||e>=t&&e<=r;return e._index>0&&e._length>0&&e._index===e._length&&e._match>0&&i(r,1,9999)&&i(e.M,1,12)&&i(e.D,1,(c=r,u=e.M||1,new Date(c,u-(c<100?22800:0),0).getDate()))&&i(e.H,o,a)&&i(e.A,0,1)&&i(e.h,n,s)&&i(e.m,0,59)&&i(e.s,0,59)&&i(e.S,0,999)&&i(e.Z,-840,720);var c,u}function v(e,t,r){const n=$(e,t,r);if(!x(n,r))return new Date(NaN);if(n.Y=n.Y?n.Y-("buddhist"===r?.calendar?543:0):1970,n.M=(n.M||1)-(n.Y<100?22801:1),n.D||=1,n.H=(n.H||0)%24||12*(n.A||0)+(n.h||0)%12,n.m||=0,n.s||=0,n.S||=0,p(r?.timeZone)){const e=Date.UTC(n.Y,n.M,n.D,n.H,n.m,n.s,n.S),t=D(e,r.timeZone);return new Date(e-1e3*t)}return y(r?.timeZone)||"Z"in n?new Date(Date.UTC(n.Y,n.M,n.D,n.H,n.m+(n.Z||0),n.s,n.S)):new Date(n.Y,n.M,n.D,n.H,n.m,n.s,n.S)}function A(e,t,r){if(p(r)){const n=c(e,r.zone_name);n.month+=t,n.timezoneOffset=0;const s=new Date(u(n));s.getUTCDate()<n.day&&s.setUTCDate(0);const o=u({...n,year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate()}),a=D(o,r);return new Date(o-1e3*a)}const n=new Date(e.getTime());return y(r)?(n.setUTCMonth(n.getUTCMonth()+t),n.getUTCDate()<e.getUTCDate()?(n.setUTCDate(0),n):n):(n.setMonth(n.getMonth()+t),n.getDate()<e.getDate()?(n.setDate(0),n):n)}const U=/^\[(.*)\]$/,Y=(e,t)=>(e.F=Math.trunc(1e6*t),e),H=(e,t)=>(e.f=Math.trunc(1e3*t),Y(e,1e3*Math.abs(t)%1/1e3)),Z=(e,t)=>(e.S=Math.trunc(t),H(e,Math.abs(t)%1)),_=(e,t)=>(e.s=Math.trunc(t/1e3),Z(e,Math.abs(t)%1e3)),k=(e,t)=>(e.m=Math.trunc(t/6e4),_(e,Math.abs(t)%6e4)),j=(e,t)=>(e.H=Math.trunc(t/36e5),k(e,Math.abs(t)%36e5)),z=(e,t,r=f)=>{const n=o(t).slice(1);return n.reduce((t,n)=>t+(t=>{if(t[0]in e){const n=e[t[0]]??0;return r.encode(`${(e=>e<0||0===e&&1/e==-1/0?"-":"")(n)}${`${Math.abs(n)}`.padStart(t.length,"0")}`)}return U.test(t)?t.replace(U,"$1"):t})(n),"")};class F{constructor(e){this.time=e}toNanoseconds(){return{value:1e6*this.time,format:(e,t)=>z(Y({},this.time),e,t),toParts:()=>({nanoseconds:Math.trunc(1e6*this.time)+0})}}toMicroseconds(){return{value:1e3*this.time,format:(e,t)=>z(H({},this.time),e,t),toParts:()=>({microseconds:Math.trunc(1e3*this.time)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toMilliseconds(){return{value:this.time,format:(e,t)=>z(Z({},this.time),e,t),toParts:()=>({milliseconds:Math.trunc(this.time)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toSeconds(){return{value:this.time/1e3,format:(e,t)=>z(_({},this.time),e,t),toParts:()=>({seconds:Math.trunc(this.time/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toMinutes(){return{value:this.time/6e4,format:(e,t)=>z(k({},this.time),e,t),toParts:()=>({minutes:Math.trunc(this.time/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toHours(){return{value:this.time/36e5,format:(e,t)=>z(j({},this.time),e,t),toParts:()=>({hours:Math.trunc(this.time/36e5)+0,minutes:Math.trunc(this.time%864e5%36e5/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toDays(){return{value:this.time/864e5,format:(e,t)=>{return z((r={},n=this.time,r.D=Math.trunc(n/864e5),j(r,Math.abs(n)%864e5)),e,t);var r,n},toParts:()=>({days:Math.trunc(this.time/864e5)+0,hours:Math.trunc(this.time%864e5/36e5)+0,minutes:Math.trunc(this.time%864e5%36e5/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}}exports.Duration=F,exports.addDays=function(e,t,r){if(p(r)){const n=c(e,r.zone_name);n.day+=t,n.timezoneOffset=0;const s=u(n),o=D(s,r);return new Date(s-1e3*o)}const n=new Date(e.getTime());return y(r)?(n.setUTCDate(n.getUTCDate()+t),n):(n.setDate(n.getDate()+t),n)},exports.addHours=function(e,t){return new Date(e.getTime()+36e5*t)},exports.addMilliseconds=function(e,t){return new Date(e.getTime()+t)},exports.addMinutes=function(e,t){return new Date(e.getTime()+6e4*t)},exports.addMonths=A,exports.addSeconds=function(e,t){return new Date(e.getTime()+1e3*t)},exports.addYears=function(e,t,r){return A(e,12*t,r)},exports.compile=o,exports.format=L,exports.isLeapYear=e=>!((e%4||!(e%100))&&e%400),exports.isSameDay=(e,t)=>e.toDateString()===t.toDateString(),exports.isValid=function(e,t,r){return x($(e,t,r),r)},exports.parse=v,exports.preparse=$,exports.subtract=(e,t)=>new F(t.getTime()-e.getTime()),exports.transform=function(e,t,r,n,s){return L(v(e,t,n),r,s)};
|
|
2
|
+
/** @preserve Copyright (c) KNOWLEDGECODE - MIT License */const e=/\\\[/g,t=/\\\]/g,r=/\uE000/g,n=/\uE001/g,s=/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g,o=o=>{const a=o.replace(e,"").replace(t,"").match(s)??[];return[o,...a.map(e=>e.replace(r,"[").replace(n,"]"))]},a=new Map,i=e=>a.get(e)??(()=>{const t=new Intl.DateTimeFormat("en-US",{hour12:!1,weekday:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZone:e});return e&&a.set(e,t),t})(),c=e=>!!e&&"object"==typeof e&&"zone_name"in e&&"gmt_offset"in e,u=e=>"string"==typeof e&&"UTC"===e.toUpperCase(),l=(e,t)=>new Date(e-1e3*((e,t)=>{const r=i("UTC"),n=i(t.zone_name),s=t.gmt_offset;for(let t=0;t<2;t++){const o=r.format(e-86400*t*1e3);for(let r=0,a=s.length;r<a;r++)if(n.format(e-1e3*(s[r]+86400*t))===o)return s[r]}return NaN})(e,t)),d=(e,t)=>{if(u(t))return{weekday:e.getUTCDay(),year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds(),fractionalSecond:e.getUTCMilliseconds(),timezoneOffset:0};const r=i(t).formatToParts(e).reduce((e,{type:t,value:r})=>{switch(t){case"weekday":e[t]="SunMonTueWedThuFriSat".indexOf(r)/3;break;case"hour":e[t]=+r%24;break;case"year":case"month":case"day":case"minute":case"second":case"fractionalSecond":e[t]=+r}return e},{weekday:4,year:1970,month:1,day:1,hour:0,minute:0,second:0,fractionalSecond:0,timezoneOffset:0});return r.timezoneOffset=(e.getTime()-Date.UTC(r.year,r.month-(r.year<100?22801:1),r.day,r.hour,r.minute,r.second,r.fractionalSecond))/6e4,r},h=e=>Date.UTC(e.year,e.month-(e.year<100?22801:1),e.day,e.hour,e.minute,e.second,e.fractionalSecond+6e4*e.timezoneOffset);class m{constructor(e,t){this.parts=d(e,t),this.time=e.getTime()}getFullYear(){return this.parts.year}getMonth(){return this.parts.month-1}getDate(){return this.parts.day}getHours(){return this.parts.hour}getMinutes(){return this.parts.minute}getSeconds(){return this.parts.second}getMilliseconds(){return this.parts.fractionalSecond}getDay(){return this.parts.weekday}getTime(){return this.time}getTimezoneOffset(){return this.parts.timezoneOffset}}class g{}const M=(e,t)=>e.getFullYear()+("buddhist"===t?543:0);const f=new class extends g{YYYY(e,t){return`000${String(M(e,t.calendar))}`.slice(-4)}YY(e,t){return`0${String(M(e,t.calendar))}`.slice(-2)}Y(e,t){return String(M(e,t.calendar))}MMMM(e,t,r){return t.locale.getMonthList({style:"long",compiledObj:r})[e.getMonth()]??""}MMM(e,t,r){return t.locale.getMonthList({style:"short",compiledObj:r})[e.getMonth()]??""}MM(e){return`0${String(e.getMonth()+1)}`.slice(-2)}M(e){return String(e.getMonth()+1)}DD(e){return`0${String(e.getDate())}`.slice(-2)}D(e){return String(e.getDate())}HH(e,t){return`0${String(e.getHours()||("h24"===t.hour24?24:0))}`.slice(-2)}H(e,t){return String(e.getHours()||("h24"===t.hour24?24:0))}AA(e,t,r){return t.locale.getMeridiemList({style:"long",compiledObj:r,case:"uppercase"})[+(e.getHours()>11)]??""}A(e,t,r){return t.locale.getMeridiemList({style:"short",compiledObj:r,case:"uppercase"})[+(e.getHours()>11)]??""}aa(e,t,r){return t.locale.getMeridiemList({style:"long",compiledObj:r,case:"lowercase"})[+(e.getHours()>11)]??""}a(e,t,r){return t.locale.getMeridiemList({style:"short",compiledObj:r,case:"lowercase"})[+(e.getHours()>11)]??""}hh(e,t){return`0${String(e.getHours()%12||("h12"===t.hour12?12:0))}`.slice(-2)}h(e,t){return String(e.getHours()%12||("h12"===t.hour12?12:0))}mm(e){return`0${String(e.getMinutes())}`.slice(-2)}m(e){return String(e.getMinutes())}ss(e){return`0${String(e.getSeconds())}`.slice(-2)}s(e){return String(e.getSeconds())}SSS(e){return`00${String(e.getMilliseconds())}`.slice(-3)}SS(e){return`00${String(e.getMilliseconds())}`.slice(-3,-1)}S(e){return`00${String(e.getMilliseconds())}`.slice(-3,-2)}dddd(e,t,r){return t.locale.getDayOfWeekList({style:"long",compiledObj:r})[e.getDay()]??""}ddd(e,t,r){return t.locale.getDayOfWeekList({style:"short",compiledObj:r})[e.getDay()]??""}dd(e,t,r){return t.locale.getDayOfWeekList({style:"narrow",compiledObj:r})[e.getDay()]??""}Z(e){const t=e.getTimezoneOffset(),r=Math.abs(t);return`${t>0?"-":"+"}${`0${String(r/60|0)}`.slice(-2)}${`0${String(r%60)}`.slice(-2)}`}ZZ(e){const t=e.getTimezoneOffset(),r=Math.abs(t);return`${t>0?"-":"+"}${`0${String(r/60|0)}`.slice(-2)}:${`0${String(r%60)}`.slice(-2)}`}},p={MMMM:["January","February","March","April","May","June","July","August","September","October","November","December"],MMM:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dd:["Su","Mo","Tu","We","Th","Fr","Sa"],A:["AM","PM"],AA:["A.M.","P.M."],a:["am","pm"],aa:["a.m.","p.m."]};var y=new class{getLocale(){return"en"}getMonthList(e){return"long"===e.style?p.MMMM:p.MMM}getDayOfWeekList(e){return"long"===e.style?p.dddd:"short"===e.style?p.ddd:p.dd}getMeridiemList(e){return"long"===e.style?"lowercase"===e.case?p.aa:p.AA:"lowercase"===e.case?p.a:p.A}},S={encode:e=>e,decode:e=>e};const D=/^\[(.*)\]$/;function L(e,t,r){const n=("string"==typeof t?o(t):t).slice(1),s=c(r?.timeZone)?r.timeZone.zone_name:r?.timeZone,a=s?new m(e,s):e,i={hour12:r?.hour12??"h12",hour24:r?.hour24??"h23",numeral:r?.numeral??S,calendar:r?.calendar??"gregory",timeZone:r?.timeZone,locale:r?.locale??y},u=[...r?.plugins??[],f],l=i.numeral.encode;return n.reduce((e,t)=>e+((e,t)=>{for(const r of u)if(r[e])return l(r[e](a,i,t));return D.test(e)?e.replace(D,"$1"):e})(t,n),"")}class T{}const C=(e,t,r)=>{const n=e.exec(t)?.[0]??"";return{value:+n,length:n.length,token:r}},w=(e,t,r)=>e.reduce((e,n,s)=>n.length>e.length&&!t.indexOf(n)?{value:s,length:n.length,token:r}:e,{value:-1,length:0,token:r});const b=new class extends T{YYYY(e){return C(/^\d{4}/,e,"Y")}Y(e){return C(/^\d{1,4}/,e,"Y")}MMMM(e,t,r){const n=t.locale.getMonthList({style:"long",compiledObj:r}),s=t.locale.getLocale(),o=t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"M"):w(n,e,"M");return o.value++,o}MMM(e,t,r){const n=t.locale.getMonthList({style:"short",compiledObj:r}),s=t.locale.getLocale(),o=t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"M"):w(n,e,"M");return o.value++,o}MM(e){return C(/^\d\d/,e,"M")}M(e){return C(/^\d\d?/,e,"M")}DD(e){return C(/^\d\d/,e,"D")}D(e){return C(/^\d\d?/,e,"D")}HH(e){return C(/^\d\d/,e,"H")}H(e){return C(/^\d\d?/,e,"H")}AA(e,t,r){const n=t.locale.getMeridiemList({style:"long",compiledObj:r,case:"uppercase"}),s=t.locale.getLocale();return t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(n,e,"A")}A(e,t,r){const n=t.locale.getMeridiemList({style:"short",compiledObj:r,case:"uppercase"}),s=t.locale.getLocale();return t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(n,e,"A")}aa(e,t,r){const n=t.locale.getMeridiemList({style:"long",compiledObj:r,case:"lowercase"}),s=t.locale.getLocale();return t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(n,e,"A")}a(e,t,r){const n=t.locale.getMeridiemList({style:"short",compiledObj:r,case:"lowercase"}),s=t.locale.getLocale();return t.ignoreCase?w(n.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(n,e,"A")}hh(e){return C(/^\d\d/,e,"h")}h(e){return C(/^\d\d?/,e,"h")}mm(e){return C(/^\d\d/,e,"m")}m(e){return C(/^\d\d?/,e,"m")}ss(e){return C(/^\d\d/,e,"s")}s(e){return C(/^\d\d?/,e,"s")}SSS(e){return C(/^\d{1,3}/,e,"S")}SS(e){const t=C(/^\d\d?/,e,"S");return t.value*=10,t}S(e){const t=C(/^\d/,e,"S");return t.value*=100,t}Z(e){const t=C(/^[+-][01]\d[0-5]\d/,e,"Z");return t.value=-60*(t.value/100|0)-t.value%100,t}ZZ(e){const t=/^([+-][01]\d):([0-5]\d)/.exec(e)??["","",""],r=+(t[1]+t[2]);return{value:-60*(r/100|0)-r%100,length:t[0].length,token:"Z"}}},O=/^\[(.*)\]$/;function x(e,t,r){const n=("string"==typeof t?o(t):t).slice(1),s={hour12:r?.hour12??"h12",hour24:r?.hour24??"h23",numeral:r?.numeral??S,calendar:r?.calendar??"gregory",ignoreCase:r?.ignoreCase??!1,timeZone:c(r?.timeZone)||u(r?.timeZone)?r.timeZone:void 0,locale:r?.locale??y},a={_index:0,_length:0,_match:0},i=[...r?.plugins??[],b],l=(e,t)=>{for(const r of i)if(r[e])return r[e](t,s,n)};e=s.numeral.decode(e);for(const t of n){const r=e.substring(a._index),n=l(t,r);if(n){if(!n.length)break;n.token&&(a[n.token]=n.value+0),a._index+=n.length,a._match++}else if(t===r[0]||" "===t)a._index++;else{if(!O.test(t)||r.indexOf(t.replace(O,"$1"))){if("..."===t){a._index=e.length;break}break}a._index+=t.length-2}}return a._length=e.length,a}function A(e,t){const r=void 0===e.Y?1970:e.Y-("buddhist"===t?.calendar?543:0),[n,s]="h11"===t?.hour12?[0,11]:[1,12],[o,a]="h24"===t?.hour24?[1,24]:[0,23],i=(e,t,r)=>void 0===e||e>=t&&e<=r;return e._index>0&&e._length>0&&e._index===e._length&&e._match>0&&i(r,1,9999)&&i(e.M,1,12)&&i(e.D,1,(c=r,u=e.M??1,new Date(c,u-(c<100?22800:0),0).getDate()))&&i(e.H,o,a)&&i(e.A,0,1)&&i(e.h,n,s)&&i(e.m,0,59)&&i(e.s,0,59)&&i(e.S,0,999)&&i(e.Z,-840,720);var c,u}function Y(e,t,r){const n=x(e,t,r);return A(n,r)?(n.Y=n.Y?n.Y-("buddhist"===r?.calendar?543:0):1970,n.M=(n.M??1)-(n.Y<100?22801:1),n.D??=1,n.H=(n.H??0)%24||12*(n.A??0)+(n.h??0)%12,n.m??=0,n.s??=0,n.S??=0,c(r?.timeZone)?l(Date.UTC(n.Y,n.M,n.D,n.H,n.m,n.s,n.S),r.timeZone):u(r?.timeZone)||"Z"in n?new Date(Date.UTC(n.Y,n.M,n.D,n.H,n.m+(n.Z??0),n.s,n.S)):new Date(n.Y,n.M,n.D,n.H,n.m,n.s,n.S)):new Date(NaN)}function $(e,t,r){if(c(r)){const n=d(e,r.zone_name);n.month+=t,n.timezoneOffset=0;const s=new Date(h(n));return s.getUTCDate()<n.day&&s.setUTCDate(0),l(h({...n,year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate()}),r)}const n=new Date(e.getTime());return u(r)?(n.setUTCMonth(n.getUTCMonth()+t),n.getUTCDate()<e.getUTCDate()?(n.setUTCDate(0),n):n):(n.setMonth(n.getMonth()+t),n.getDate()<e.getDate()?(n.setDate(0),n):n)}const v=/^\[(.*)\]$/,U=(e,t)=>(e.F=Math.trunc(1e6*t),e),H=(e,t)=>(e.f=Math.trunc(1e3*t),U(e,1e3*Math.abs(t)%1/1e3)),Z=(e,t)=>(e.S=Math.trunc(t),H(e,Math.abs(t)%1)),_=(e,t)=>(e.s=Math.trunc(t/1e3),Z(e,Math.abs(t)%1e3)),k=(e,t)=>(e.m=Math.trunc(t/6e4),_(e,Math.abs(t)%6e4)),j=(e,t)=>(e.H=Math.trunc(t/36e5),k(e,Math.abs(t)%36e5)),z=(e,t,r=S)=>{const n=o(t).slice(1);return n.reduce((t,n)=>t+(t=>{if(t[0]in e){const n=e[t[0]]??0;return r.encode(`${(e=>e<0||0===e&&1/e==-1/0?"-":"")(n)}${String(Math.abs(n)).padStart(t.length,"0")}`)}return v.test(t)?t.replace(v,"$1"):t})(n),"")};class F{constructor(e){this.time=e}toNanoseconds(){return{value:1e6*this.time,format:(e,t)=>z(U({},this.time),e,t),toParts:()=>({nanoseconds:Math.trunc(1e6*this.time)+0})}}toMicroseconds(){return{value:1e3*this.time,format:(e,t)=>z(H({},this.time),e,t),toParts:()=>({microseconds:Math.trunc(1e3*this.time)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toMilliseconds(){return{value:this.time,format:(e,t)=>z(Z({},this.time),e,t),toParts:()=>({milliseconds:Math.trunc(this.time)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toSeconds(){return{value:this.time/1e3,format:(e,t)=>z(_({},this.time),e,t),toParts:()=>({seconds:Math.trunc(this.time/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toMinutes(){return{value:this.time/6e4,format:(e,t)=>z(k({},this.time),e,t),toParts:()=>({minutes:Math.trunc(this.time/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toHours(){return{value:this.time/36e5,format:(e,t)=>z(j({},this.time),e,t),toParts:()=>({hours:Math.trunc(this.time/36e5)+0,minutes:Math.trunc(this.time%864e5%36e5/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toDays(){return{value:this.time/864e5,format:(e,t)=>{return z((r={},n=this.time,r.D=Math.trunc(n/864e5),j(r,Math.abs(n)%864e5)),e,t);var r,n},toParts:()=>({days:Math.trunc(this.time/864e5)+0,hours:Math.trunc(this.time%864e5/36e5)+0,minutes:Math.trunc(this.time%864e5%36e5/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}}exports.Duration=F,exports.addDays=function(e,t,r){if(c(r)){const n=d(e,r.zone_name);return n.day+=t,n.timezoneOffset=0,l(h(n),r)}const n=new Date(e.getTime());return u(r)?(n.setUTCDate(n.getUTCDate()+t),n):(n.setDate(n.getDate()+t),n)},exports.addHours=function(e,t){return new Date(e.getTime()+36e5*t)},exports.addMilliseconds=function(e,t){return new Date(e.getTime()+t)},exports.addMinutes=function(e,t){return new Date(e.getTime()+6e4*t)},exports.addMonths=$,exports.addSeconds=function(e,t){return new Date(e.getTime()+1e3*t)},exports.addYears=function(e,t,r){return $(e,12*t,r)},exports.compile=o,exports.format=L,exports.isLeapYear=e=>!((e%4||!(e%100))&&e%400),exports.isSameDay=(e,t)=>e.toDateString()===t.toDateString(),exports.isValid=function(e,t,r){return A(x(e,t,r),r)},exports.parse=Y,exports.preparse=x,exports.subtract=(e,t)=>new F(t.getTime()-e.getTime()),exports.transform=function(e,t,r,n,s){return L(Y(e,t,n),r,s)};
|
package/dist/index.d.ts
CHANGED
|
@@ -97,11 +97,11 @@ interface FormatterPluginOptions {
|
|
|
97
97
|
*/
|
|
98
98
|
calendar: 'buddhist' | 'gregory';
|
|
99
99
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
timeZone: TimeZone |
|
|
100
|
+
* The time zone to use for formatting dates and times.
|
|
101
|
+
* This can be a specific time zone object, an IANA time zone name, or 'UTC' to use Coordinated Universal Time.
|
|
102
|
+
* If not specified, it defaults to undefined, which means the local time zone will be used.
|
|
103
|
+
*/
|
|
104
|
+
timeZone: TimeZone | string | undefined;
|
|
105
105
|
/**
|
|
106
106
|
* The locale to use for formatting dates and times.
|
|
107
107
|
* This is an object that provides methods to get localized month names, day names, and meridiems.
|
|
@@ -109,7 +109,7 @@ interface FormatterPluginOptions {
|
|
|
109
109
|
locale: Locale;
|
|
110
110
|
}
|
|
111
111
|
declare abstract class FormatterPlugin {
|
|
112
|
-
[key: string]: (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string;
|
|
112
|
+
[key: string]: ((d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string) | undefined;
|
|
113
113
|
}
|
|
114
114
|
interface FormatterOptions extends Partial<FormatterPluginOptions> {
|
|
115
115
|
plugins?: FormatterPlugin[];
|
|
@@ -172,7 +172,7 @@ interface ParseResult {
|
|
|
172
172
|
token?: ParserToken;
|
|
173
173
|
}
|
|
174
174
|
declare abstract class ParserPlugin {
|
|
175
|
-
[key: string]: (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult;
|
|
175
|
+
[key: string]: ((str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult) | undefined;
|
|
176
176
|
}
|
|
177
177
|
interface ParserOptions extends Partial<ParserPluginOptions> {
|
|
178
178
|
plugins?: ParserPlugin[];
|
|
@@ -370,7 +370,7 @@ interface DurationDescriptor<T> {
|
|
|
370
370
|
}
|
|
371
371
|
declare class Duration {
|
|
372
372
|
private readonly time;
|
|
373
|
-
constructor(time:
|
|
373
|
+
constructor(time: DOMHighResTimeStamp);
|
|
374
374
|
/**
|
|
375
375
|
* Converts the duration to nanoseconds.
|
|
376
376
|
* @returns DurationDescriptor with the value in nanoseconds and methods to format and get
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @preserve Copyright (c) KNOWLEDGECODE - MIT License */
|
|
2
|
-
const e=/\\\[/g,t=/\\\]/g,n=/\uE000/g,r=/\uE001/g,s=/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g,o=o=>{const a=o.replace(e,"").replace(t,"").match(s)||[];return[o,...a.map(e=>e.replace(n,"[").replace(r,"]"))]},a=new Map,i=e=>a.get(e)||(()=>{const t=new Intl.DateTimeFormat("en-US",{hour12:!1,weekday:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZone:e});return e&&a.set(e,t),t})(),c=(e,t)=>{if("UTC"===t?.toUpperCase())return{weekday:e.getUTCDay(),year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds(),fractionalSecond:e.getUTCMilliseconds(),timezoneOffset:0};const n=i(t).formatToParts(e).reduce((e,{type:t,value:n})=>{switch(t){case"weekday":e[t]="SunMonTueWedThuFriSat".indexOf(n)/3;break;case"hour":e[t]=+n%24;break;case"year":case"month":case"day":case"minute":case"second":case"fractionalSecond":e[t]=+n}return e},{weekday:4,year:1970,month:1,day:1,hour:0,minute:0,second:0,fractionalSecond:0,timezoneOffset:0});return n.timezoneOffset=(e.getTime()-Date.UTC(n.year,n.month-(n.year<100?22801:1),n.day,n.hour,n.minute,n.second,n.fractionalSecond))/6e4,n},u=e=>Date.UTC(e.year,e.month-(e.year<100?22801:1),e.day,e.hour,e.minute,e.second,e.fractionalSecond+6e4*e.timezoneOffset);class l{constructor(e,t){this.parts=c(e,t),this.time=e.getTime()}getFullYear(){return this.parts.year}getMonth(){return this.parts.month-1}getDate(){return this.parts.day}getHours(){return this.parts.hour}getMinutes(){return this.parts.minute}getSeconds(){return this.parts.second}getMilliseconds(){return this.parts.fractionalSecond}getDay(){return this.parts.weekday}getTime(){return this.time}getTimezoneOffset(){return this.parts.timezoneOffset}}class h{}const d=(e,t)=>e.getFullYear()+("buddhist"===t?543:0);const m=new class extends h{YYYY(e,t){return`000${d(e,t.calendar)}`.slice(-4)}YY(e,t){return`0${d(e,t.calendar)}`.slice(-2)}Y(e,t){return`${d(e,t.calendar)}`}MMMM(e,t,n){return t.locale.getMonthList({style:"long",compiledObj:n})[e.getMonth()]||""}MMM(e,t,n){return t.locale.getMonthList({style:"short",compiledObj:n})[e.getMonth()]||""}MM(e){return`0${e.getMonth()+1}`.slice(-2)}M(e){return`${e.getMonth()+1}`}DD(e){return`0${e.getDate()}`.slice(-2)}D(e){return`${e.getDate()}`}HH(e,t){return`0${e.getHours()||("h24"===t.hour24?24:0)}`.slice(-2)}H(e,t){return`${e.getHours()||("h24"===t.hour24?24:0)}`}AA(e,t,n){return t.locale.getMeridiemList({style:"long",compiledObj:n,case:"uppercase"})[+(e.getHours()>11)]||""}A(e,t,n){return t.locale.getMeridiemList({style:"short",compiledObj:n,case:"uppercase"})[+(e.getHours()>11)]||""}aa(e,t,n){return t.locale.getMeridiemList({style:"long",compiledObj:n,case:"lowercase"})[+(e.getHours()>11)]||""}a(e,t,n){return t.locale.getMeridiemList({style:"short",compiledObj:n,case:"lowercase"})[+(e.getHours()>11)]||""}hh(e,t){return`0${e.getHours()%12||("h12"===t.hour12?12:0)}`.slice(-2)}h(e,t){return`${e.getHours()%12||("h12"===t.hour12?12:0)}`}mm(e){return`0${e.getMinutes()}`.slice(-2)}m(e){return`${e.getMinutes()}`}ss(e){return`0${e.getSeconds()}`.slice(-2)}s(e){return`${e.getSeconds()}`}SSS(e){return`00${e.getMilliseconds()}`.slice(-3)}SS(e){return`00${e.getMilliseconds()}`.slice(-3,-1)}S(e){return`00${e.getMilliseconds()}`.slice(-3,-2)}dddd(e,t,n){return t.locale.getDayOfWeekList({style:"long",compiledObj:n})[e.getDay()]||""}ddd(e,t,n){return t.locale.getDayOfWeekList({style:"short",compiledObj:n})[e.getDay()]||""}dd(e,t,n){return t.locale.getDayOfWeekList({style:"narrow",compiledObj:n})[e.getDay()]||""}Z(e){const t=e.getTimezoneOffset(),n=Math.abs(t);return`${t>0?"-":"+"}${("0"+(n/60|0)).slice(-2)}${("0"+n%60).slice(-2)}`}ZZ(e){const t=e.getTimezoneOffset(),n=Math.abs(t);return`${t>0?"-":"+"}${("0"+(n/60|0)).slice(-2)}:${("0"+n%60).slice(-2)}`}},g={MMMM:["January","February","March","April","May","June","July","August","September","October","November","December"],MMM:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dd:["Su","Mo","Tu","We","Th","Fr","Sa"],A:["AM","PM"],AA:["A.M.","P.M."],a:["am","pm"],aa:["a.m.","p.m."]};var M=new class{getLocale(){return"en"}getMonthList(e){return"long"===e.style?g.MMMM:g.MMM}getDayOfWeekList(e){return"long"===e.style?g.dddd:"short"===e.style?g.ddd:g.dd}getMeridiemList(e){return"long"===e.style?"lowercase"===e.case?g.aa:g.AA:"lowercase"===e.case?g.a:g.A}},f={encode:e=>e,decode:e=>e};const y=e=>"object"==typeof e&&"zone_name"in e&&"gmt_offset"in e,D=e=>"UTC"===e,p=(e,t)=>{const n=i("UTC"),r=i(t.zone_name),s=t.gmt_offset;for(let t=0;t<2;t++){const o=n.format(e-86400*t*1e3);for(let n=0,a=s.length;n<a;n++)if(r.format(e-1e3*(s[n]+86400*t))===o)return s[n]}return NaN},T=/^\[(.*)\]$/;function L(e,t,n){const r=("string"==typeof t?o(t):t).slice(1),s=y(n?.timeZone)||D(n?.timeZone)?n.timeZone:void 0,a="string"==typeof s?s:s?.zone_name||"",i=a?new l(e,a):e,c={hour12:n?.hour12||"h12",hour24:n?.hour24||"h23",numeral:n?.numeral||f,calendar:n?.calendar||"gregory",timeZone:s,locale:n?.locale||M},u=[...n?.plugins||[],m],h=c.numeral.encode;return r.reduce((e,t)=>e+((e,t)=>{for(const n of u)if(n[e])return h(n[e](i,c,t));return T.test(e)?e.replace(T,"$1"):e})(t,r),"")}class C{}const S=(e,t,n)=>{const r=e.exec(t)?.[0]||"";return{value:+r,length:r.length,token:n}},w=(e,t,n)=>e.reduce((e,r,s)=>r.length>e.length&&!t.indexOf(r)?{value:s,length:r.length,token:n}:e,{value:-1,length:0,token:n});const b=new class extends C{YYYY(e){return S(/^\d{4}/,e,"Y")}Y(e){return S(/^\d{1,4}/,e,"Y")}MMMM(e,t,n){const r=t.locale.getMonthList({style:"long",compiledObj:n}),s=t.locale.getLocale(),o=t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"M"):w(r,e,"M");return o.value++,o}MMM(e,t,n){const r=t.locale.getMonthList({style:"short",compiledObj:n}),s=t.locale.getLocale(),o=t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"M"):w(r,e,"M");return o.value++,o}MM(e){return S(/^\d\d/,e,"M")}M(e){return S(/^\d\d?/,e,"M")}DD(e){return S(/^\d\d/,e,"D")}D(e){return S(/^\d\d?/,e,"D")}HH(e){return S(/^\d\d/,e,"H")}H(e){return S(/^\d\d?/,e,"H")}AA(e,t,n){const r=t.locale.getMeridiemList({style:"long",compiledObj:n,case:"uppercase"}),s=t.locale.getLocale();return t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(r,e,"A")}A(e,t,n){const r=t.locale.getMeridiemList({style:"short",compiledObj:n,case:"uppercase"}),s=t.locale.getLocale();return t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(r,e,"A")}aa(e,t,n){const r=t.locale.getMeridiemList({style:"long",compiledObj:n,case:"lowercase"}),s=t.locale.getLocale();return t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(r,e,"A")}a(e,t,n){const r=t.locale.getMeridiemList({style:"short",compiledObj:n,case:"lowercase"}),s=t.locale.getLocale();return t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(r,e,"A")}hh(e){return S(/^\d\d/,e,"h")}h(e){return S(/^\d\d?/,e,"h")}mm(e){return S(/^\d\d/,e,"m")}m(e){return S(/^\d\d?/,e,"m")}ss(e){return S(/^\d\d/,e,"s")}s(e){return S(/^\d\d?/,e,"s")}SSS(e){return S(/^\d{1,3}/,e,"S")}SS(e){const t=S(/^\d\d?/,e,"S");return t.value*=10,t}S(e){const t=S(/^\d/,e,"S");return t.value*=100,t}Z(e){const t=S(/^[+-][01]\d[0-5]\d/,e,"Z");return t.value=-60*(t.value/100|0)-t.value%100,t}ZZ(e){const t=/^([+-][01]\d):([0-5]\d)/.exec(e)||["","",""],n=+(t[1]+t[2]);return{value:-60*(n/100|0)-n%100,length:t[0].length,token:"Z"}}},O=/^\[(.*)\]$/;function $(e,t,n){const r=("string"==typeof t?o(t):t).slice(1),s={hour12:n?.hour12||"h12",hour24:n?.hour24||"h23",numeral:n?.numeral||f,calendar:n?.calendar||"gregory",ignoreCase:n?.ignoreCase||!1,timeZone:y(n?.timeZone)||D(n?.timeZone)?n.timeZone:void 0,locale:n?.locale||M},a={_index:0,_length:0,_match:0},i=[...n?.plugins||[],b],c=(e,t)=>{for(const n of i)if(n[e])return n[e](t,s,r)};e=s.numeral.decode(e);for(const t of r){const n=e.substring(a._index),r=c(t,n);if(r){if(!r.length)break;r.token&&(a[r.token]=r.value+0),a._index+=r.length,a._match++}else if(t===n[0]||" "===t)a._index++;else{if(!O.test(t)||n.indexOf(t.replace(O,"$1"))){if("..."===t){a._index=e.length;break}break}a._index+=t.length-2}}return a._length=e.length,a}function v(e,t){const n=void 0===e.Y?1970:e.Y-("buddhist"===t?.calendar?543:0),[r,s]="h11"===t?.hour12?[0,11]:[1,12],[o,a]="h24"===t?.hour24?[1,24]:[0,23],i=(e,t,n)=>void 0===e||e>=t&&e<=n;return e._index>0&&e._length>0&&e._index===e._length&&e._match>0&&i(n,1,9999)&&i(e.M,1,12)&&i(e.D,1,(c=n,u=e.M||1,new Date(c,u-(c<100?22800:0),0).getDate()))&&i(e.H,o,a)&&i(e.A,0,1)&&i(e.h,r,s)&&i(e.m,0,59)&&i(e.s,0,59)&&i(e.S,0,999)&&i(e.Z,-840,720);var c,u}function A(e,t,n){return v($(e,t,n),n)}function U(e,t,n){const r=$(e,t,n);if(!v(r,n))return new Date(NaN);if(r.Y=r.Y?r.Y-("buddhist"===n?.calendar?543:0):1970,r.M=(r.M||1)-(r.Y<100?22801:1),r.D||=1,r.H=(r.H||0)%24||12*(r.A||0)+(r.h||0)%12,r.m||=0,r.s||=0,r.S||=0,y(n?.timeZone)){const e=Date.UTC(r.Y,r.M,r.D,r.H,r.m,r.s,r.S),t=p(e,n.timeZone);return new Date(e-1e3*t)}return D(n?.timeZone)||"Z"in r?new Date(Date.UTC(r.Y,r.M,r.D,r.H,r.m+(r.Z||0),r.s,r.S)):new Date(r.Y,r.M,r.D,r.H,r.m,r.s,r.S)}function Y(e,t,n,r,s){return L(U(e,t,r),n,s)}function H(e,t,n){if(y(n)){const r=c(e,n.zone_name);r.month+=t,r.timezoneOffset=0;const s=new Date(u(r));s.getUTCDate()<r.day&&s.setUTCDate(0);const o=u({...r,year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate()}),a=p(o,n);return new Date(o-1e3*a)}const r=new Date(e.getTime());return D(n)?(r.setUTCMonth(r.getUTCMonth()+t),r.getUTCDate()<e.getUTCDate()?(r.setUTCDate(0),r):r):(r.setMonth(r.getMonth()+t),r.getDate()<e.getDate()?(r.setDate(0),r):r)}function Z(e,t,n){return H(e,12*t,n)}function _(e,t,n){if(y(n)){const r=c(e,n.zone_name);r.day+=t,r.timezoneOffset=0;const s=u(r),o=p(s,n);return new Date(s-1e3*o)}const r=new Date(e.getTime());return D(n)?(r.setUTCDate(r.getUTCDate()+t),r):(r.setDate(r.getDate()+t),r)}function k(e,t){return new Date(e.getTime()+36e5*t)}function j(e,t){return new Date(e.getTime()+6e4*t)}function x(e,t){return new Date(e.getTime()+1e3*t)}function z(e,t){return new Date(e.getTime()+t)}const F=/^\[(.*)\]$/,P=(e,t)=>(e.F=Math.trunc(1e6*t),e),W=(e,t)=>(e.f=Math.trunc(1e3*t),P(e,1e3*Math.abs(t)%1/1e3)),N=(e,t)=>(e.S=Math.trunc(t),W(e,Math.abs(t)%1)),J=(e,t)=>(e.s=Math.trunc(t/1e3),N(e,Math.abs(t)%1e3)),E=(e,t)=>(e.m=Math.trunc(t/6e4),J(e,Math.abs(t)%6e4)),I=(e,t)=>(e.H=Math.trunc(t/36e5),E(e,Math.abs(t)%36e5)),q=(e,t,n=f)=>{const r=o(t).slice(1);return r.reduce((t,r)=>t+(t=>{if(t[0]in e){const r=e[t[0]]??0;return n.encode(`${(e=>e<0||0===e&&1/e==-1/0?"-":"")(r)}${`${Math.abs(r)}`.padStart(t.length,"0")}`)}return F.test(t)?t.replace(F,"$1"):t})(r),"")};class B{constructor(e){this.time=e}toNanoseconds(){return{value:1e6*this.time,format:(e,t)=>q(P({},this.time),e,t),toParts:()=>({nanoseconds:Math.trunc(1e6*this.time)+0})}}toMicroseconds(){return{value:1e3*this.time,format:(e,t)=>q(W({},this.time),e,t),toParts:()=>({microseconds:Math.trunc(1e3*this.time)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toMilliseconds(){return{value:this.time,format:(e,t)=>q(N({},this.time),e,t),toParts:()=>({milliseconds:Math.trunc(this.time)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toSeconds(){return{value:this.time/1e3,format:(e,t)=>q(J({},this.time),e,t),toParts:()=>({seconds:Math.trunc(this.time/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toMinutes(){return{value:this.time/6e4,format:(e,t)=>q(E({},this.time),e,t),toParts:()=>({minutes:Math.trunc(this.time/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toHours(){return{value:this.time/36e5,format:(e,t)=>q(I({},this.time),e,t),toParts:()=>({hours:Math.trunc(this.time/36e5)+0,minutes:Math.trunc(this.time%864e5%36e5/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toDays(){return{value:this.time/864e5,format:(e,t)=>{return q((n={},r=this.time,n.D=Math.trunc(r/864e5),I(n,Math.abs(r)%864e5)),e,t);var n,r},toParts:()=>({days:Math.trunc(this.time/864e5)+0,hours:Math.trunc(this.time%864e5/36e5)+0,minutes:Math.trunc(this.time%864e5%36e5/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}}const G=(e,t)=>new B(t.getTime()-e.getTime()),K=e=>!((e%4||!(e%100))&&e%400),Q=(e,t)=>e.toDateString()===t.toDateString();export{B as Duration,_ as addDays,k as addHours,z as addMilliseconds,j as addMinutes,H as addMonths,x as addSeconds,Z as addYears,o as compile,L as format,K as isLeapYear,Q as isSameDay,A as isValid,U as parse,$ as preparse,G as subtract,Y as transform};
|
|
2
|
+
const e=/\\\[/g,t=/\\\]/g,n=/\uE000/g,r=/\uE001/g,s=/\[(?:[^[\]]|\[[^[\]]*])*]|([A-Za-z])\1*|\.{3}|./g,o=o=>{const a=o.replace(e,"").replace(t,"").match(s)??[];return[o,...a.map(e=>e.replace(n,"[").replace(r,"]"))]},a=new Map,i=e=>a.get(e)??(()=>{const t=new Intl.DateTimeFormat("en-US",{hour12:!1,weekday:"short",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",fractionalSecondDigits:3,timeZone:e});return e&&a.set(e,t),t})(),c=e=>!!e&&"object"==typeof e&&"zone_name"in e&&"gmt_offset"in e,u=e=>"string"==typeof e&&"UTC"===e.toUpperCase(),l=(e,t)=>new Date(e-1e3*((e,t)=>{const n=i("UTC"),r=i(t.zone_name),s=t.gmt_offset;for(let t=0;t<2;t++){const o=n.format(e-86400*t*1e3);for(let n=0,a=s.length;n<a;n++)if(r.format(e-1e3*(s[n]+86400*t))===o)return s[n]}return NaN})(e,t)),h=(e,t)=>{if(u(t))return{weekday:e.getUTCDay(),year:e.getUTCFullYear(),month:e.getUTCMonth()+1,day:e.getUTCDate(),hour:e.getUTCHours(),minute:e.getUTCMinutes(),second:e.getUTCSeconds(),fractionalSecond:e.getUTCMilliseconds(),timezoneOffset:0};const n=i(t).formatToParts(e).reduce((e,{type:t,value:n})=>{switch(t){case"weekday":e[t]="SunMonTueWedThuFriSat".indexOf(n)/3;break;case"hour":e[t]=+n%24;break;case"year":case"month":case"day":case"minute":case"second":case"fractionalSecond":e[t]=+n}return e},{weekday:4,year:1970,month:1,day:1,hour:0,minute:0,second:0,fractionalSecond:0,timezoneOffset:0});return n.timezoneOffset=(e.getTime()-Date.UTC(n.year,n.month-(n.year<100?22801:1),n.day,n.hour,n.minute,n.second,n.fractionalSecond))/6e4,n},d=e=>Date.UTC(e.year,e.month-(e.year<100?22801:1),e.day,e.hour,e.minute,e.second,e.fractionalSecond+6e4*e.timezoneOffset);class m{constructor(e,t){this.parts=h(e,t),this.time=e.getTime()}getFullYear(){return this.parts.year}getMonth(){return this.parts.month-1}getDate(){return this.parts.day}getHours(){return this.parts.hour}getMinutes(){return this.parts.minute}getSeconds(){return this.parts.second}getMilliseconds(){return this.parts.fractionalSecond}getDay(){return this.parts.weekday}getTime(){return this.time}getTimezoneOffset(){return this.parts.timezoneOffset}}class g{}const M=(e,t)=>e.getFullYear()+("buddhist"===t?543:0);const f=new class extends g{YYYY(e,t){return`000${String(M(e,t.calendar))}`.slice(-4)}YY(e,t){return`0${String(M(e,t.calendar))}`.slice(-2)}Y(e,t){return String(M(e,t.calendar))}MMMM(e,t,n){return t.locale.getMonthList({style:"long",compiledObj:n})[e.getMonth()]??""}MMM(e,t,n){return t.locale.getMonthList({style:"short",compiledObj:n})[e.getMonth()]??""}MM(e){return`0${String(e.getMonth()+1)}`.slice(-2)}M(e){return String(e.getMonth()+1)}DD(e){return`0${String(e.getDate())}`.slice(-2)}D(e){return String(e.getDate())}HH(e,t){return`0${String(e.getHours()||("h24"===t.hour24?24:0))}`.slice(-2)}H(e,t){return String(e.getHours()||("h24"===t.hour24?24:0))}AA(e,t,n){return t.locale.getMeridiemList({style:"long",compiledObj:n,case:"uppercase"})[+(e.getHours()>11)]??""}A(e,t,n){return t.locale.getMeridiemList({style:"short",compiledObj:n,case:"uppercase"})[+(e.getHours()>11)]??""}aa(e,t,n){return t.locale.getMeridiemList({style:"long",compiledObj:n,case:"lowercase"})[+(e.getHours()>11)]??""}a(e,t,n){return t.locale.getMeridiemList({style:"short",compiledObj:n,case:"lowercase"})[+(e.getHours()>11)]??""}hh(e,t){return`0${String(e.getHours()%12||("h12"===t.hour12?12:0))}`.slice(-2)}h(e,t){return String(e.getHours()%12||("h12"===t.hour12?12:0))}mm(e){return`0${String(e.getMinutes())}`.slice(-2)}m(e){return String(e.getMinutes())}ss(e){return`0${String(e.getSeconds())}`.slice(-2)}s(e){return String(e.getSeconds())}SSS(e){return`00${String(e.getMilliseconds())}`.slice(-3)}SS(e){return`00${String(e.getMilliseconds())}`.slice(-3,-1)}S(e){return`00${String(e.getMilliseconds())}`.slice(-3,-2)}dddd(e,t,n){return t.locale.getDayOfWeekList({style:"long",compiledObj:n})[e.getDay()]??""}ddd(e,t,n){return t.locale.getDayOfWeekList({style:"short",compiledObj:n})[e.getDay()]??""}dd(e,t,n){return t.locale.getDayOfWeekList({style:"narrow",compiledObj:n})[e.getDay()]??""}Z(e){const t=e.getTimezoneOffset(),n=Math.abs(t);return`${t>0?"-":"+"}${`0${String(n/60|0)}`.slice(-2)}${`0${String(n%60)}`.slice(-2)}`}ZZ(e){const t=e.getTimezoneOffset(),n=Math.abs(t);return`${t>0?"-":"+"}${`0${String(n/60|0)}`.slice(-2)}:${`0${String(n%60)}`.slice(-2)}`}},y={MMMM:["January","February","March","April","May","June","July","August","September","October","November","December"],MMM:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dd:["Su","Mo","Tu","We","Th","Fr","Sa"],A:["AM","PM"],AA:["A.M.","P.M."],a:["am","pm"],aa:["a.m.","p.m."]};var S=new class{getLocale(){return"en"}getMonthList(e){return"long"===e.style?y.MMMM:y.MMM}getDayOfWeekList(e){return"long"===e.style?y.dddd:"short"===e.style?y.ddd:y.dd}getMeridiemList(e){return"long"===e.style?"lowercase"===e.case?y.aa:y.AA:"lowercase"===e.case?y.a:y.A}},p={encode:e=>e,decode:e=>e};const D=/^\[(.*)\]$/;function T(e,t,n){const r=("string"==typeof t?o(t):t).slice(1),s=c(n?.timeZone)?n.timeZone.zone_name:n?.timeZone,a=s?new m(e,s):e,i={hour12:n?.hour12??"h12",hour24:n?.hour24??"h23",numeral:n?.numeral??p,calendar:n?.calendar??"gregory",timeZone:n?.timeZone,locale:n?.locale??S},u=[...n?.plugins??[],f],l=i.numeral.encode;return r.reduce((e,t)=>e+((e,t)=>{for(const n of u)if(n[e])return l(n[e](a,i,t));return D.test(e)?e.replace(D,"$1"):e})(t,r),"")}class L{}const C=(e,t,n)=>{const r=e.exec(t)?.[0]??"";return{value:+r,length:r.length,token:n}},w=(e,t,n)=>e.reduce((e,r,s)=>r.length>e.length&&!t.indexOf(r)?{value:s,length:r.length,token:n}:e,{value:-1,length:0,token:n});const b=new class extends L{YYYY(e){return C(/^\d{4}/,e,"Y")}Y(e){return C(/^\d{1,4}/,e,"Y")}MMMM(e,t,n){const r=t.locale.getMonthList({style:"long",compiledObj:n}),s=t.locale.getLocale(),o=t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"M"):w(r,e,"M");return o.value++,o}MMM(e,t,n){const r=t.locale.getMonthList({style:"short",compiledObj:n}),s=t.locale.getLocale(),o=t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"M"):w(r,e,"M");return o.value++,o}MM(e){return C(/^\d\d/,e,"M")}M(e){return C(/^\d\d?/,e,"M")}DD(e){return C(/^\d\d/,e,"D")}D(e){return C(/^\d\d?/,e,"D")}HH(e){return C(/^\d\d/,e,"H")}H(e){return C(/^\d\d?/,e,"H")}AA(e,t,n){const r=t.locale.getMeridiemList({style:"long",compiledObj:n,case:"uppercase"}),s=t.locale.getLocale();return t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(r,e,"A")}A(e,t,n){const r=t.locale.getMeridiemList({style:"short",compiledObj:n,case:"uppercase"}),s=t.locale.getLocale();return t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(r,e,"A")}aa(e,t,n){const r=t.locale.getMeridiemList({style:"long",compiledObj:n,case:"lowercase"}),s=t.locale.getLocale();return t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(r,e,"A")}a(e,t,n){const r=t.locale.getMeridiemList({style:"short",compiledObj:n,case:"lowercase"}),s=t.locale.getLocale();return t.ignoreCase?w(r.map(e=>e.toLocaleLowerCase(s)),e.toLocaleLowerCase(s),"A"):w(r,e,"A")}hh(e){return C(/^\d\d/,e,"h")}h(e){return C(/^\d\d?/,e,"h")}mm(e){return C(/^\d\d/,e,"m")}m(e){return C(/^\d\d?/,e,"m")}ss(e){return C(/^\d\d/,e,"s")}s(e){return C(/^\d\d?/,e,"s")}SSS(e){return C(/^\d{1,3}/,e,"S")}SS(e){const t=C(/^\d\d?/,e,"S");return t.value*=10,t}S(e){const t=C(/^\d/,e,"S");return t.value*=100,t}Z(e){const t=C(/^[+-][01]\d[0-5]\d/,e,"Z");return t.value=-60*(t.value/100|0)-t.value%100,t}ZZ(e){const t=/^([+-][01]\d):([0-5]\d)/.exec(e)??["","",""],n=+(t[1]+t[2]);return{value:-60*(n/100|0)-n%100,length:t[0].length,token:"Z"}}},O=/^\[(.*)\]$/;function A(e,t,n){const r=("string"==typeof t?o(t):t).slice(1),s={hour12:n?.hour12??"h12",hour24:n?.hour24??"h23",numeral:n?.numeral??p,calendar:n?.calendar??"gregory",ignoreCase:n?.ignoreCase??!1,timeZone:c(n?.timeZone)||u(n?.timeZone)?n.timeZone:void 0,locale:n?.locale??S},a={_index:0,_length:0,_match:0},i=[...n?.plugins??[],b],l=(e,t)=>{for(const n of i)if(n[e])return n[e](t,s,r)};e=s.numeral.decode(e);for(const t of r){const n=e.substring(a._index),r=l(t,n);if(r){if(!r.length)break;r.token&&(a[r.token]=r.value+0),a._index+=r.length,a._match++}else if(t===n[0]||" "===t)a._index++;else{if(!O.test(t)||n.indexOf(t.replace(O,"$1"))){if("..."===t){a._index=e.length;break}break}a._index+=t.length-2}}return a._length=e.length,a}function $(e,t){const n=void 0===e.Y?1970:e.Y-("buddhist"===t?.calendar?543:0),[r,s]="h11"===t?.hour12?[0,11]:[1,12],[o,a]="h24"===t?.hour24?[1,24]:[0,23],i=(e,t,n)=>void 0===e||e>=t&&e<=n;return e._index>0&&e._length>0&&e._index===e._length&&e._match>0&&i(n,1,9999)&&i(e.M,1,12)&&i(e.D,1,(c=n,u=e.M??1,new Date(c,u-(c<100?22800:0),0).getDate()))&&i(e.H,o,a)&&i(e.A,0,1)&&i(e.h,r,s)&&i(e.m,0,59)&&i(e.s,0,59)&&i(e.S,0,999)&&i(e.Z,-840,720);var c,u}function v(e,t,n){return $(A(e,t,n),n)}function U(e,t,n){const r=A(e,t,n);return $(r,n)?(r.Y=r.Y?r.Y-("buddhist"===n?.calendar?543:0):1970,r.M=(r.M??1)-(r.Y<100?22801:1),r.D??=1,r.H=(r.H??0)%24||12*(r.A??0)+(r.h??0)%12,r.m??=0,r.s??=0,r.S??=0,c(n?.timeZone)?l(Date.UTC(r.Y,r.M,r.D,r.H,r.m,r.s,r.S),n.timeZone):u(n?.timeZone)||"Z"in r?new Date(Date.UTC(r.Y,r.M,r.D,r.H,r.m+(r.Z??0),r.s,r.S)):new Date(r.Y,r.M,r.D,r.H,r.m,r.s,r.S)):new Date(NaN)}function Y(e,t,n,r,s){return T(U(e,t,r),n,s)}function H(e,t,n){if(c(n)){const r=h(e,n.zone_name);r.month+=t,r.timezoneOffset=0;const s=new Date(d(r));return s.getUTCDate()<r.day&&s.setUTCDate(0),l(d({...r,year:s.getUTCFullYear(),month:s.getUTCMonth()+1,day:s.getUTCDate()}),n)}const r=new Date(e.getTime());return u(n)?(r.setUTCMonth(r.getUTCMonth()+t),r.getUTCDate()<e.getUTCDate()?(r.setUTCDate(0),r):r):(r.setMonth(r.getMonth()+t),r.getDate()<e.getDate()?(r.setDate(0),r):r)}function Z(e,t,n){return H(e,12*t,n)}function _(e,t,n){if(c(n)){const r=h(e,n.zone_name);return r.day+=t,r.timezoneOffset=0,l(d(r),n)}const r=new Date(e.getTime());return u(n)?(r.setUTCDate(r.getUTCDate()+t),r):(r.setDate(r.getDate()+t),r)}function k(e,t){return new Date(e.getTime()+36e5*t)}function j(e,t){return new Date(e.getTime()+6e4*t)}function x(e,t){return new Date(e.getTime()+1e3*t)}function z(e,t){return new Date(e.getTime()+t)}const F=/^\[(.*)\]$/,P=(e,t)=>(e.F=Math.trunc(1e6*t),e),W=(e,t)=>(e.f=Math.trunc(1e3*t),P(e,1e3*Math.abs(t)%1/1e3)),N=(e,t)=>(e.S=Math.trunc(t),W(e,Math.abs(t)%1)),J=(e,t)=>(e.s=Math.trunc(t/1e3),N(e,Math.abs(t)%1e3)),E=(e,t)=>(e.m=Math.trunc(t/6e4),J(e,Math.abs(t)%6e4)),I=(e,t)=>(e.H=Math.trunc(t/36e5),E(e,Math.abs(t)%36e5)),q=(e,t,n=p)=>{const r=o(t).slice(1);return r.reduce((t,r)=>t+(t=>{if(t[0]in e){const r=e[t[0]]??0;return n.encode(`${(e=>e<0||0===e&&1/e==-1/0?"-":"")(r)}${String(Math.abs(r)).padStart(t.length,"0")}`)}return F.test(t)?t.replace(F,"$1"):t})(r),"")};class B{constructor(e){this.time=e}toNanoseconds(){return{value:1e6*this.time,format:(e,t)=>q(P({},this.time),e,t),toParts:()=>({nanoseconds:Math.trunc(1e6*this.time)+0})}}toMicroseconds(){return{value:1e3*this.time,format:(e,t)=>q(W({},this.time),e,t),toParts:()=>({microseconds:Math.trunc(1e3*this.time)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toMilliseconds(){return{value:this.time,format:(e,t)=>q(N({},this.time),e,t),toParts:()=>({milliseconds:Math.trunc(this.time)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toSeconds(){return{value:this.time/1e3,format:(e,t)=>q(J({},this.time),e,t),toParts:()=>({seconds:Math.trunc(this.time/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toMinutes(){return{value:this.time/6e4,format:(e,t)=>q(E({},this.time),e,t),toParts:()=>({minutes:Math.trunc(this.time/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toHours(){return{value:this.time/36e5,format:(e,t)=>q(I({},this.time),e,t),toParts:()=>({hours:Math.trunc(this.time/36e5)+0,minutes:Math.trunc(this.time%864e5%36e5/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}toDays(){return{value:this.time/864e5,format:(e,t)=>{return q((n={},r=this.time,n.D=Math.trunc(r/864e5),I(n,Math.abs(r)%864e5)),e,t);var n,r},toParts:()=>({days:Math.trunc(this.time/864e5)+0,hours:Math.trunc(this.time%864e5/36e5)+0,minutes:Math.trunc(this.time%864e5%36e5/6e4)+0,seconds:Math.trunc(this.time%864e5%36e5%6e4/1e3)+0,milliseconds:Math.trunc(this.time%1e3)+0,microseconds:Math.trunc(1e3*this.time%1e3)+0,nanoseconds:Math.trunc(1e6*this.time%1e3)+0})}}}const G=(e,t)=>new B(t.getTime()-e.getTime()),K=e=>!((e%4||!(e%100))&&e%400),Q=(e,t)=>e.toDateString()===t.toDateString();export{B as Duration,_ as addDays,k as addHours,z as addMilliseconds,j as addMinutes,H as addMonths,x as addSeconds,Z as addYears,o as compile,T as format,K as isLeapYear,Q as isSameDay,v as isValid,U as parse,A as preparse,G as subtract,Y as transform};
|
package/dist/numerals/arab.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e="٠١٢٣٤٥٦٧٨٩",
|
|
1
|
+
"use strict";const e="٠١٢٣٤٥٦٧٨٩",r=e.split(""),t=Object.fromEntries(r.map((e,r)=>[e,String(r)]));var c={encode:e=>e.replace(/\d/g,e=>r[+e]),decode:r=>r.replace(new RegExp(`[${e}]`,"g"),e=>t[e])};module.exports=c;
|
package/dist/numerals/arab.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="٠١٢٣٤٥٦٧٨٩",
|
|
1
|
+
const e="٠١٢٣٤٥٦٧٨٩",r=e.split(""),t=Object.fromEntries(r.map((e,r)=>[e,String(r)]));var a={encode:e=>e.replace(/\d/g,e=>r[+e]),decode:r=>r.replace(new RegExp(`[${e}]`,"g"),e=>t[e])};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e="۰۱۲۳۴۵۶۷۸۹",
|
|
1
|
+
"use strict";const e="۰۱۲۳۴۵۶۷۸۹",r=e.split(""),t=Object.fromEntries(r.map((e,r)=>[e,String(r)]));var c={encode:e=>e.replace(/\d/g,e=>r[+e]),decode:r=>r.replace(new RegExp(`[${e}]`,"g"),e=>t[e])};module.exports=c;
|
package/dist/numerals/arabext.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="۰۱۲۳۴۵۶۷۸۹",
|
|
1
|
+
const e="۰۱۲۳۴۵۶۷۸۹",r=e.split(""),t=Object.fromEntries(r.map((e,r)=>[e,String(r)]));var a={encode:e=>e.replace(/\d/g,e=>r[+e]),decode:r=>r.replace(new RegExp(`[${e}]`,"g"),e=>t[e])};export{a as default};
|
package/dist/numerals/beng.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e="০১২৩৪৫৬৭৮৯",
|
|
1
|
+
"use strict";const e="০১২৩৪৫৬৭৮৯",r=e.split(""),t=Object.fromEntries(r.map((e,r)=>[e,String(r)]));var c={encode:e=>e.replace(/\d/g,e=>r[+e]),decode:r=>r.replace(new RegExp(`[${e}]`,"g"),e=>t[e])};module.exports=c;
|
package/dist/numerals/beng.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="০১২৩৪৫৬৭৮৯",
|
|
1
|
+
const e="০১২৩৪৫৬৭৮৯",r=e.split(""),t=Object.fromEntries(r.map((e,r)=>[e,String(r)]));var a={encode:e=>e.replace(/\d/g,e=>r[+e]),decode:r=>r.replace(new RegExp(`[${e}]`,"g"),e=>t[e])};export{a as default};
|
package/dist/numerals/mymr.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e="၀၁၂၃၄၅၆၇၈၉",
|
|
1
|
+
"use strict";const e="၀၁၂၃၄၅၆၇၈၉",r=e.split(""),t=Object.fromEntries(r.map((e,r)=>[e,String(r)]));var c={encode:e=>e.replace(/\d/g,e=>r[+e]),decode:r=>r.replace(new RegExp(`[${e}]`,"g"),e=>t[e])};module.exports=c;
|
package/dist/numerals/mymr.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="၀၁၂၃၄၅၆၇၈၉",
|
|
1
|
+
const e="၀၁၂၃၄၅၆၇၈၉",r=e.split(""),t=Object.fromEntries(r.map((e,r)=>[e,String(r)]));var a={encode:e=>e.replace(/\d/g,e=>r[+e]),decode:r=>r.replace(new RegExp(`[${e}]`,"g"),e=>t[e])};export{a as default};
|
package/dist/plugin.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.FormatterPlugin=class{},exports.ParserPlugin=class{},exports.exec=(e,t,n)=>{const l=e.exec(t)?.[0]
|
|
1
|
+
"use strict";exports.FormatterPlugin=class{},exports.ParserPlugin=class{},exports.exec=(e,t,n)=>{const l=e.exec(t)?.[0]??"";return{value:+l,length:l.length,token:n}},exports.find=(e,t,n)=>e.reduce((e,l,r)=>l.length>e.length&&!t.indexOf(l)?{value:r,length:l.length,token:n}:e,{value:-1,length:0,token:n});
|
package/dist/plugin.d.ts
CHANGED
|
@@ -90,11 +90,11 @@ interface FormatterPluginOptions {
|
|
|
90
90
|
*/
|
|
91
91
|
calendar: 'buddhist' | 'gregory';
|
|
92
92
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
timeZone: TimeZone |
|
|
93
|
+
* The time zone to use for formatting dates and times.
|
|
94
|
+
* This can be a specific time zone object, an IANA time zone name, or 'UTC' to use Coordinated Universal Time.
|
|
95
|
+
* If not specified, it defaults to undefined, which means the local time zone will be used.
|
|
96
|
+
*/
|
|
97
|
+
timeZone: TimeZone | string | undefined;
|
|
98
98
|
/**
|
|
99
99
|
* The locale to use for formatting dates and times.
|
|
100
100
|
* This is an object that provides methods to get localized month names, day names, and meridiems.
|
|
@@ -102,7 +102,7 @@ interface FormatterPluginOptions {
|
|
|
102
102
|
locale: Locale;
|
|
103
103
|
}
|
|
104
104
|
declare abstract class FormatterPlugin {
|
|
105
|
-
[key: string]: (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string;
|
|
105
|
+
[key: string]: ((d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string) | undefined;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
type ParserToken = 'Y' | 'M' | 'D' | 'H' | 'A' | 'h' | 'm' | 's' | 'S' | 'Z';
|
|
@@ -153,7 +153,7 @@ interface ParseResult {
|
|
|
153
153
|
token?: ParserToken;
|
|
154
154
|
}
|
|
155
155
|
declare abstract class ParserPlugin {
|
|
156
|
-
[key: string]: (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult;
|
|
156
|
+
[key: string]: ((str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult) | undefined;
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
159
|
* Executes a regular expression against a string and returns parsed result.
|
package/dist/plugin.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class e{}class n{}const t=(e,n,t)=>{const l=e.exec(n)?.[0]
|
|
1
|
+
class e{}class n{}const t=(e,n,t)=>{const l=e.exec(n)?.[0]??"";return{value:+l,length:l.length,token:t}},l=(e,n,t)=>e.reduce((e,l,g)=>l.length>e.length&&!n.indexOf(l)?{value:g,length:l.length,token:t}:e,{value:-1,length:0,token:t});export{e as FormatterPlugin,n as ParserPlugin,t as exec,l as find};
|
|
@@ -71,7 +71,7 @@ interface ParseResult {
|
|
|
71
71
|
token?: ParserToken;
|
|
72
72
|
}
|
|
73
73
|
declare abstract class ParserPlugin {
|
|
74
|
-
[key: string]: (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult;
|
|
74
|
+
[key: string]: ((str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult) | undefined;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
declare class Parser extends ParserPlugin {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";class e{}const t=(e,t,n)=>{const r=e.exec(t)?.[0]
|
|
1
|
+
"use strict";class e{}const t=(e,t,n)=>{const r=e.exec(t)?.[0]??"";return{value:+r,length:r.length,token:n}};const n=new class extends e{SSSS(e){const n=t(/^\d{1,4}/,e,"S");return n.value=Math.trunc(n.value/10),n}SSSSS(e){const n=t(/^\d{1,5}/,e,"S");return n.value=Math.trunc(n.value/100),n}SSSSSS(e){const n=t(/^\d{1,6}/,e,"S");return n.value=Math.trunc(n.value/1e3),n}f(e){return t(/^\d/,e)}ff(e){return t(/^\d\d?/,e)}fff(e){return t(/^\d{1,3}/,e)}};exports.parser=n;
|
|
@@ -71,7 +71,7 @@ interface ParseResult {
|
|
|
71
71
|
token?: ParserToken;
|
|
72
72
|
}
|
|
73
73
|
declare abstract class ParserPlugin {
|
|
74
|
-
[key: string]: (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult;
|
|
74
|
+
[key: string]: ((str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult) | undefined;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
declare class Parser extends ParserPlugin {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class e{}const t=(e,t,n)=>{const r=e.exec(t)?.[0]
|
|
1
|
+
class e{}const t=(e,t,n)=>{const r=e.exec(t)?.[0]??"";return{value:+r,length:r.length,token:n}};const n=new class extends e{SSSS(e){const n=t(/^\d{1,4}/,e,"S");return n.value=Math.trunc(n.value/10),n}SSSSS(e){const n=t(/^\d{1,5}/,e,"S");return n.value=Math.trunc(n.value/100),n}SSSSSS(e){const n=t(/^\d{1,6}/,e,"S");return n.value=Math.trunc(n.value/1e3),n}f(e){return t(/^\d/,e)}ff(e){return t(/^\d\d?/,e)}fff(e){return t(/^\d{1,3}/,e)}};export{n as parser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";class e{}const S=(e,S,t)=>{const n=e.exec(S)?.[0]
|
|
1
|
+
"use strict";class e{}const S=(e,S,t)=>{const n=e.exec(S)?.[0]??"";return{value:+n,length:n.length,token:t}};const t=new class extends e{SSSSSSS(e){const t=S(/^\d{1,7}/,e,"S");return t.value=Math.trunc(t.value/1e4),t}SSSSSSSS(e){const t=S(/^\d{1,8}/,e,"S");return t.value=Math.trunc(t.value/1e5),t}SSSSSSSSS(e){const t=S(/^\d{1,9}/,e,"S");return t.value=Math.trunc(t.value/1e6),t}F(e){return S(/^\d/,e)}FF(e){return S(/^\d\d?/,e)}FFF(e){return S(/^\d{1,3}/,e)}};exports.parser=t;
|
|
@@ -71,7 +71,7 @@ interface ParseResult {
|
|
|
71
71
|
token?: ParserToken;
|
|
72
72
|
}
|
|
73
73
|
declare abstract class ParserPlugin {
|
|
74
|
-
[key: string]: (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult;
|
|
74
|
+
[key: string]: ((str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult) | undefined;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
declare class Parser extends ParserPlugin {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class S{}const e=(S,e,t)=>{const n=S.exec(e)?.[0]
|
|
1
|
+
class S{}const e=(S,e,t)=>{const n=S.exec(e)?.[0]??"";return{value:+n,length:n.length,token:t}};const t=new class extends S{SSSSSSS(S){const t=e(/^\d{1,7}/,S,"S");return t.value=Math.trunc(t.value/1e4),t}SSSSSSSS(S){const t=e(/^\d{1,8}/,S,"S");return t.value=Math.trunc(t.value/1e5),t}SSSSSSSSS(S){const t=e(/^\d{1,9}/,S,"S");return t.value=Math.trunc(t.value/1e6),t}F(S){return e(/^\d/,S)}FF(S){return e(/^\d\d?/,S)}FFF(S){return e(/^\d{1,3}/,S)}};export{t as parser};
|
package/dist/plugins/ordinal.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";class e{}class t{}const s=new class extends e{DDD(e){const t=e.getDate();switch(t){case
|
|
1
|
+
"use strict";class e{}class t{}const s=new class extends e{DDD(e){const t=String(e.getDate());switch(t){case"1":case"21":case"31":return`${t}st`;case"2":case"22":return`${t}nd`;case"3":case"23":return`${t}rd`;default:return`${t}th`}}},r=new class extends t{DDD(e,t){const s=((e,t,s)=>{const r=e.exec(t)?.[0]??"";return{value:+r,length:r.length,token:s}})(/^\d\d?(?=st|nd|rd|th)/,t.ignoreCase?e.toLowerCase():e,"D");return s.length>0&&(s.length+=2),s}};exports.formatter=s,exports.parser=r;
|
|
@@ -90,11 +90,11 @@ interface FormatterPluginOptions {
|
|
|
90
90
|
*/
|
|
91
91
|
calendar: 'buddhist' | 'gregory';
|
|
92
92
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
timeZone: TimeZone |
|
|
93
|
+
* The time zone to use for formatting dates and times.
|
|
94
|
+
* This can be a specific time zone object, an IANA time zone name, or 'UTC' to use Coordinated Universal Time.
|
|
95
|
+
* If not specified, it defaults to undefined, which means the local time zone will be used.
|
|
96
|
+
*/
|
|
97
|
+
timeZone: TimeZone | string | undefined;
|
|
98
98
|
/**
|
|
99
99
|
* The locale to use for formatting dates and times.
|
|
100
100
|
* This is an object that provides methods to get localized month names, day names, and meridiems.
|
|
@@ -102,7 +102,7 @@ interface FormatterPluginOptions {
|
|
|
102
102
|
locale: Locale;
|
|
103
103
|
}
|
|
104
104
|
declare abstract class FormatterPlugin {
|
|
105
|
-
[key: string]: (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string;
|
|
105
|
+
[key: string]: ((d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string) | undefined;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
type ParserToken = 'Y' | 'M' | 'D' | 'H' | 'A' | 'h' | 'm' | 's' | 'S' | 'Z';
|
|
@@ -153,7 +153,7 @@ interface ParseResult {
|
|
|
153
153
|
token?: ParserToken;
|
|
154
154
|
}
|
|
155
155
|
declare abstract class ParserPlugin {
|
|
156
|
-
[key: string]: (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult;
|
|
156
|
+
[key: string]: ((str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult) | undefined;
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
declare class Formatter extends FormatterPlugin {
|
package/dist/plugins/ordinal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
class e{}class t{}const s=new class extends e{DDD(e){const t=e.getDate();switch(t){case
|
|
1
|
+
class e{}class t{}const s=new class extends e{DDD(e){const t=String(e.getDate());switch(t){case"1":case"21":case"31":return`${t}st`;case"2":case"22":return`${t}nd`;case"3":case"23":return`${t}rd`;default:return`${t}th`}}},n=new class extends t{DDD(e,t){const s=((e,t,s)=>{const n=e.exec(t)?.[0]??"";return{value:+n,length:n.length,token:s}})(/^\d\d?(?=st|nd|rd|th)/,t.ignoreCase?e.toLowerCase():e,"D");return s.length>0&&(s.length+=2),s}};export{s as formatter,n as parser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";class e{}const s=new class extends e{YY(e,s){const t=((e,s,t)=>{const l=e.exec(s)?.[0]
|
|
1
|
+
"use strict";class e{}const s=new class extends e{YY(e,s){const t=((e,s,t)=>{const l=e.exec(s)?.[0]??"";return{value:+l,length:l.length,token:t}})(/^\d\d/,e,"Y");if("buddhist"===s.calendar)t.value+=t.value<13?2600:2500;else t.value+=t.value<70?2e3:1900;return t}};exports.parser=s;
|
|
@@ -71,7 +71,7 @@ interface ParseResult {
|
|
|
71
71
|
token?: ParserToken;
|
|
72
72
|
}
|
|
73
73
|
declare abstract class ParserPlugin {
|
|
74
|
-
[key: string]: (str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult;
|
|
74
|
+
[key: string]: ((str: string, options: ParserPluginOptions, compiledObj: CompiledObject) => ParseResult) | undefined;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
declare class Parser extends ParserPlugin {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class e{}const l=new class extends e{YY(e,l){const n=((e,l,n)=>{const t=e.exec(l)?.[0]
|
|
1
|
+
class e{}const l=new class extends e{YY(e,l){const n=((e,l,n)=>{const t=e.exec(l)?.[0]??"";return{value:+t,length:t.length,token:n}})(/^\d\d/,e,"Y");if("buddhist"===l.calendar)n.value+=n.value<13?2600:2500;else n.value+=n.value<70?2e3:1900;return n}};export{l as parser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var a={"Acre Standard Time":"ACT","Acre Summer Time":"ACST","Afghanistan Time":"AFT","Alaska Daylight Time":"AKDT","Alaska Standard Time":"AKST","Almaty Standard Time":"ALMT","Almaty Summer Time":"ALMST","Amazon Standard Time":"AMT","Amazon Summer Time":"AMST","American Samoa Standard Time":"SST","Anadyr Standard Time":"ANAT","Anadyr Summer Time":"ANAST","Aqtau Standard Time":"AQTT","Aqtau Summer Time":"AQTST","Aqtobe Standard Time":"AQTT","Aqtobe Summer Time":"AQTST","Arabian Daylight Time":"ADT","Arabian Standard Time":"AST","Argentina Standard Time":"ART","Argentina Summer Time":"ARST","Armenia Standard Time":"AMT","Armenia Summer Time":"AMST","Atlantic Daylight Time":"ADT","Atlantic Standard Time":"AST","Australian Central Daylight Time":"ACDT","Australian Central Standard Time":"ACST","Australian Central Western Daylight Time":"ACWDT","Australian Central Western Standard Time":"ACWST","Australian Eastern Daylight Time":"AEDT","Australian Eastern Standard Time":"AEST","Australian Western Daylight Time":"AWDT","Australian Western Standard Time":"AWST","Azerbaijan Standard Time":"AZT","Azerbaijan Summer Time":"AZST","Azores Standard Time":"AZOT","Azores Summer Time":"AZOST","Bangladesh Standard Time":"BST","Bangladesh Summer Time":"BDST","Bhutan Time":"BTT","Bolivia Time":"BOT","Brasilia Standard Time":"BRT","Brasilia Summer Time":"BRST","British Summer Time":"BST","Brunei Time":"BNT","Cape Verde Standard Time":"CVT","Casey Time":"CAST","Central Africa Time":"CAT","Central Daylight Time":"CDT","Central European Standard Time":"CET","Central European Summer Time":"CEST","Central Indonesia Time":"WITA","Central Standard Time":"CST","Chamorro Standard Time":"ChST","Chatham Daylight Time":"CHADT","Chatham Standard Time":"CHAST","Chile Standard Time":"CLT","Chile Summer Time":"CLST","China Daylight Time":"CDT","China Standard Time":"CST","Christmas Island Time":"CXT","Chuuk Time":"CHUT","Cocos Islands Time":"CCT","Colombia Standard Time":"COT","Colombia Summer Time":"COST","Cook Islands Standard Time":"CKT","Cook Islands Summer Time":"CKST","Coordinated Universal Time":"UTC","Cuba Daylight Time":"CDT","Cuba Standard Time":"CST","Davis Time":"DAVT","Dumont d’Urville Time":"DDUT","East Africa Time":"EAT","East Greenland Standard Time":"EGT","East Greenland Summer Time":"EGST","East Kazakhstan Time":"ALMT","Easter Island Standard Time":"EAST","Easter Island Summer Time":"EASST","Eastern Daylight Time":"EDT","Eastern European Standard Time":"EET","Eastern European Summer Time":"EEST","Eastern Indonesia Time":"WIT","Eastern Standard Time":"EST","Ecuador Time":"ECT","Falkland Islands Standard Time":"FKST","Falkland Islands Summer Time":"FKST","Fernando de Noronha Standard Time":"FNT","Fernando de Noronha Summer Time":"FNST","Fiji Standard Time":"FJT","Fiji Summer Time":"FJST","French Guiana Time":"GFT","French Southern & Antarctic Time":"TFT","Further-eastern European Time":"FET","Galapagos Time":"GALT","Gambier Time":"GAMT","Georgia Standard Time":"GET","Georgia Summer Time":"GEST","Gilbert Islands Time":"GILT","Greenland Standard Time":"GT","Greenland Summer Time":"GST","Greenwich Mean Time":"GMT","Guam Standard Time":"ChST","Gulf Standard Time":"GST","Guyana Time":"GYT","Hawaii-Aleutian Daylight Time":"HADT","Hawaii-Aleutian Standard Time":"HAST","Hong Kong Standard Time":"HKT","Hong Kong Summer Time":"HKST","Hovd Standard Time":"HOVT","Hovd Summer Time":"HOVST","India Standard Time":"IST","Indian Ocean Time":"IOT","Indochina Time":"ICT","Iran Daylight Time":"IRDT","Iran Standard Time":"IRST","Irish Standard Time":"IST","Irkutsk Standard Time":"IRKT","Irkutsk Summer Time":"IRKST","Israel Daylight Time":"IDT","Israel Standard Time":"IST","Japan Standard Time":"JST","Kamchatka Standard Time":"PETT","Kamchatka Summer Time":"PETST","Kazakhstan Time":"KZT","Korean Daylight Time":"KDT","Korean Standard Time":"KST","Kosrae Time":"KOST","Krasnoyarsk Standard Time":"KRAT","Krasnoyarsk Summer Time":"KRAST","Kyrgyzstan Time":"KGT","Lanka Time":"LKT","Line Islands Time":"LINT","Lord Howe Daylight Time":"LHDT","Lord Howe Standard Time":"LHST","Macao Standard Time":"CST","Macao Summer Time":"CST","Magadan Standard Time":"MAGT","Magadan Summer Time":"MAGST","Malaysia Time":"MYT","Maldives Time":"MVT","Marquesas Time":"MART","Marshall Islands Time":"MHT","Mauritius Standard Time":"MUT","Mauritius Summer Time":"MUST","Mawson Time":"MAWT","Mexican Pacific Daylight Time":"PDT","Mexican Pacific Standard Time":"PST","Moscow Standard Time":"MSK","Moscow Summer Time":"MSD","Mountain Daylight Time":"MDT","Mountain Standard Time":"MST","Myanmar Time":"MMT","Nauru Time":"NRT","Nepal Time":"NPT","New Caledonia Standard Time":"NCT","New Caledonia Summer Time":"NCST","New Zealand Daylight Time":"NZDT","New Zealand Standard Time":"NZST","Newfoundland Daylight Time":"NDT","Newfoundland Standard Time":"NST","Niue Time":"NUT","Norfolk Island Daylight Time":"NFDT","Norfolk Island Standard Time":"NFT","North Korea Time":"KST","Northern Mariana Islands Time":"CHST","Novosibirsk Standard Time":"NOVT","Novosibirsk Summer Time":"NOVST","Omsk Standard Time":"OMST","Omsk Summer Time":"OMSST","Pacific Daylight Time":"PDT","Pacific Standard Time":"PST","Pakistan Standard Time":"PKT","Pakistan Summer Time":"PKST","Palau Time":"PWT","Papua New Guinea Time":"PGT","Paraguay Standard Time":"PYT","Paraguay Summer Time":"PYST","Peru Standard Time":"PET","Peru Summer Time":"PEST","Philippine Standard Time":"PST","Philippine Summer Time":"PHST","Phoenix Islands Time":"PHOT","Pitcairn Time":"PIT","Pohnpei Time":"PONT","Qyzylorda Standard Time":"QYZT","Qyzylorda Summer Time":"QYZST","
|
|
1
|
+
"use strict";var a={"Acre Standard Time":"ACT","Acre Summer Time":"ACST","Afghanistan Time":"AFT","Alaska Daylight Time":"AKDT","Alaska Standard Time":"AKST","Almaty Standard Time":"ALMT","Almaty Summer Time":"ALMST","Amazon Standard Time":"AMT","Amazon Summer Time":"AMST","American Samoa Standard Time":"SST","Anadyr Standard Time":"ANAT","Anadyr Summer Time":"ANAST","Aqtau Standard Time":"AQTT","Aqtau Summer Time":"AQTST","Aqtobe Standard Time":"AQTT","Aqtobe Summer Time":"AQTST","Arabian Daylight Time":"ADT","Arabian Standard Time":"AST","Argentina Standard Time":"ART","Argentina Summer Time":"ARST","Armenia Standard Time":"AMT","Armenia Summer Time":"AMST","Atlantic Daylight Time":"ADT","Atlantic Standard Time":"AST","Australian Central Daylight Time":"ACDT","Australian Central Standard Time":"ACST","Australian Central Western Daylight Time":"ACWDT","Australian Central Western Standard Time":"ACWST","Australian Eastern Daylight Time":"AEDT","Australian Eastern Standard Time":"AEST","Australian Western Daylight Time":"AWDT","Australian Western Standard Time":"AWST","Azerbaijan Standard Time":"AZT","Azerbaijan Summer Time":"AZST","Azores Standard Time":"AZOT","Azores Summer Time":"AZOST","Bangladesh Standard Time":"BST","Bangladesh Summer Time":"BDST","Bhutan Time":"BTT","Bolivia Time":"BOT","Brasilia Standard Time":"BRT","Brasilia Summer Time":"BRST","British Summer Time":"BST","Brunei Time":"BNT","Cape Verde Standard Time":"CVT","Casey Time":"CAST","Central Africa Time":"CAT","Central Daylight Time":"CDT","Central European Standard Time":"CET","Central European Summer Time":"CEST","Central Indonesia Time":"WITA","Central Standard Time":"CST","Chamorro Standard Time":"ChST","Chatham Daylight Time":"CHADT","Chatham Standard Time":"CHAST","Chile Standard Time":"CLT","Chile Summer Time":"CLST","China Daylight Time":"CDT","China Standard Time":"CST","Christmas Island Time":"CXT","Chuuk Time":"CHUT","Cocos Islands Time":"CCT","Colombia Standard Time":"COT","Colombia Summer Time":"COST","Cook Islands Standard Time":"CKT","Cook Islands Summer Time":"CKST","Coordinated Universal Time":"UTC","Cuba Daylight Time":"CDT","Cuba Standard Time":"CST","Davis Time":"DAVT","Dumont d’Urville Time":"DDUT","East Africa Time":"EAT","East Greenland Standard Time":"EGT","East Greenland Summer Time":"EGST","East Kazakhstan Time":"ALMT","Easter Island Standard Time":"EAST","Easter Island Summer Time":"EASST","Eastern Daylight Time":"EDT","Eastern European Standard Time":"EET","Eastern European Summer Time":"EEST","Eastern Indonesia Time":"WIT","Eastern Standard Time":"EST","Ecuador Time":"ECT","Falkland Islands Standard Time":"FKST","Falkland Islands Summer Time":"FKST","Fernando de Noronha Standard Time":"FNT","Fernando de Noronha Summer Time":"FNST","Fiji Standard Time":"FJT","Fiji Summer Time":"FJST","French Guiana Time":"GFT","French Southern & Antarctic Time":"TFT","Further-eastern European Time":"FET","Galapagos Time":"GALT","Gambier Time":"GAMT","Georgia Standard Time":"GET","Georgia Summer Time":"GEST","Gilbert Islands Time":"GILT","Greenland Standard Time":"GT","Greenland Summer Time":"GST","Greenwich Mean Time":"GMT","Guam Standard Time":"ChST","Gulf Standard Time":"GST","Guyana Time":"GYT","Hawaii-Aleutian Daylight Time":"HADT","Hawaii-Aleutian Standard Time":"HAST","Hong Kong Standard Time":"HKT","Hong Kong Summer Time":"HKST","Hovd Standard Time":"HOVT","Hovd Summer Time":"HOVST","India Standard Time":"IST","Indian Ocean Time":"IOT","Indochina Time":"ICT","Iran Daylight Time":"IRDT","Iran Standard Time":"IRST","Irish Standard Time":"IST","Irkutsk Standard Time":"IRKT","Irkutsk Summer Time":"IRKST","Israel Daylight Time":"IDT","Israel Standard Time":"IST","Japan Standard Time":"JST","Kamchatka Standard Time":"PETT","Kamchatka Summer Time":"PETST","Kazakhstan Time":"KZT","Korean Daylight Time":"KDT","Korean Standard Time":"KST","Kosrae Time":"KOST","Krasnoyarsk Standard Time":"KRAT","Krasnoyarsk Summer Time":"KRAST","Kyrgyzstan Time":"KGT","Lanka Time":"LKT","Line Islands Time":"LINT","Lord Howe Daylight Time":"LHDT","Lord Howe Standard Time":"LHST","Macao Standard Time":"CST","Macao Summer Time":"CST","Magadan Standard Time":"MAGT","Magadan Summer Time":"MAGST","Malaysia Time":"MYT","Maldives Time":"MVT","Marquesas Time":"MART","Marshall Islands Time":"MHT","Mauritius Standard Time":"MUT","Mauritius Summer Time":"MUST","Mawson Time":"MAWT","Mexican Pacific Daylight Time":"PDT","Mexican Pacific Standard Time":"PST","Moscow Standard Time":"MSK","Moscow Summer Time":"MSD","Mountain Daylight Time":"MDT","Mountain Standard Time":"MST","Myanmar Time":"MMT","Nauru Time":"NRT","Nepal Time":"NPT","New Caledonia Standard Time":"NCT","New Caledonia Summer Time":"NCST","New Zealand Daylight Time":"NZDT","New Zealand Standard Time":"NZST","Newfoundland Daylight Time":"NDT","Newfoundland Standard Time":"NST","Niue Time":"NUT","Norfolk Island Daylight Time":"NFDT","Norfolk Island Standard Time":"NFT","North Korea Time":"KST","Northern Mariana Islands Time":"CHST","Novosibirsk Standard Time":"NOVT","Novosibirsk Summer Time":"NOVST","Omsk Standard Time":"OMST","Omsk Summer Time":"OMSST","Pacific Daylight Time":"PDT","Pacific Standard Time":"PST","Pakistan Standard Time":"PKT","Pakistan Summer Time":"PKST","Palau Time":"PWT","Papua New Guinea Time":"PGT","Paraguay Standard Time":"PYT","Paraguay Summer Time":"PYST","Peru Standard Time":"PET","Peru Summer Time":"PEST","Philippine Standard Time":"PST","Philippine Summer Time":"PHST","Phoenix Islands Time":"PHOT","Pitcairn Time":"PIT","Pohnpei Time":"PONT","Qyzylorda Standard Time":"QYZT","Qyzylorda Summer Time":"QYZST","Réunion Time":"RET","Rothera Time":"ROTT","Sakhalin Standard Time":"SAKT","Sakhalin Summer Time":"SAKST","Samara Standard Time":"SAMT","Samara Summer Time":"SAMST","Samoa Daylight Time":"SDT","Samoa Standard Time":"SST","Seychelles Time":"SCT","Singapore Standard Time":"SGT","Solomon Islands Time":"SBT","South Africa Standard Time":"SAST","South Georgia Time":"GST","St. Pierre & Miquelon Daylight Time":"PMDT","St. Pierre & Miquelon Standard Time":"PMST","Suriname Time":"SRT","Syowa Time":"SYOT","Tahiti Time":"TAHT","Taiwan Daylight Time":"CDT","Taiwan Standard Time":"CST","Tajikistan Time":"TJT","Timor-Leste Time":"TLT","Tokelau Time":"TKT","Tonga Standard Time":"TOT","Tonga Summer Time":"TOST","Turkmenistan Standard Time":"TMT","Tuvalu Time":"TVT","Ulaanbaatar Standard Time":"ULAT","Ulaanbaatar Summer Time":"ULAST","Uruguay Standard Time":"UYT","Uruguay Summer Time":"UYST","Uzbekistan Standard Time":"UZT","Uzbekistan Summer Time":"UZST","Vanuatu Standard Time":"VUT","Vanuatu Summer Time":"VUST","Venezuela Time":"VET","Vladivostok Standard Time":"VLAT","Vladivostok Summer Time":"VLAST","Volgograd Standard Time":"VOLT","Volgograd Summer Time":"VOLST","Vostok Time":"VOST","Wake Island Time":"WAKT","Wallis & Futuna Time":"WFT","West Africa Standard Time":"WAT","West Africa Summer Time":"WAST","West Greenland Standard Time":"WGT","West Greenland Summer Time":"WGST","West Kazakhstan Time":"AQTT","Western Argentina Standard Time":"ART","Western Argentina Summer Time":"ARST","Western European Standard Time":"WET","Western European Summer Time":"WEST","Western Indonesia Time":"WIB","Yakutsk Standard Time":"YAKT","Yakutsk Summer Time":"YAKST","Yekaterinburg Standard Time":"YEKT","Yekaterinburg Summer Time":"YEKST","Yukon Time":"YT"};class e{}const T=a=>!!a&&"object"==typeof a&&"zone_name"in a&&"gmt_offset"in a,i=(a,e)=>{const T=new Intl.DateTimeFormat("en-US",{timeZone:e??void 0,timeZoneName:"long"}).formatToParts(a);return T.find(a=>"timeZoneName"===a.type)?.value.replace(/^GMT[+-].+$/,"")??""};const m=new class extends e{z(e,m){const n=T(m.timeZone)?m.timeZone.zone_name:m.timeZone;return((e,T)=>a[i(e,T)]||"")(e.getTime(),n)}zz(a,e){const m=T(e.timeZone)?e.timeZone.zone_name:e.timeZone;return i(a.getTime(),m)}};exports.formatter=m;
|
|
@@ -90,11 +90,11 @@ interface FormatterPluginOptions {
|
|
|
90
90
|
*/
|
|
91
91
|
calendar: 'buddhist' | 'gregory';
|
|
92
92
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
timeZone: TimeZone |
|
|
93
|
+
* The time zone to use for formatting dates and times.
|
|
94
|
+
* This can be a specific time zone object, an IANA time zone name, or 'UTC' to use Coordinated Universal Time.
|
|
95
|
+
* If not specified, it defaults to undefined, which means the local time zone will be used.
|
|
96
|
+
*/
|
|
97
|
+
timeZone: TimeZone | string | undefined;
|
|
98
98
|
/**
|
|
99
99
|
* The locale to use for formatting dates and times.
|
|
100
100
|
* This is an object that provides methods to get localized month names, day names, and meridiems.
|
|
@@ -102,7 +102,7 @@ interface FormatterPluginOptions {
|
|
|
102
102
|
locale: Locale;
|
|
103
103
|
}
|
|
104
104
|
declare abstract class FormatterPlugin {
|
|
105
|
-
[key: string]: (d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string;
|
|
105
|
+
[key: string]: ((d: DateLike, options: FormatterPluginOptions, compiledObj: CompiledObject) => string) | undefined;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
declare class Formatter extends FormatterPlugin {
|
package/dist/plugins/zonename.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var a={"Acre Standard Time":"ACT","Acre Summer Time":"ACST","Afghanistan Time":"AFT","Alaska Daylight Time":"AKDT","Alaska Standard Time":"AKST","Almaty Standard Time":"ALMT","Almaty Summer Time":"ALMST","Amazon Standard Time":"AMT","Amazon Summer Time":"AMST","American Samoa Standard Time":"SST","Anadyr Standard Time":"ANAT","Anadyr Summer Time":"ANAST","Aqtau Standard Time":"AQTT","Aqtau Summer Time":"AQTST","Aqtobe Standard Time":"AQTT","Aqtobe Summer Time":"AQTST","Arabian Daylight Time":"ADT","Arabian Standard Time":"AST","Argentina Standard Time":"ART","Argentina Summer Time":"ARST","Armenia Standard Time":"AMT","Armenia Summer Time":"AMST","Atlantic Daylight Time":"ADT","Atlantic Standard Time":"AST","Australian Central Daylight Time":"ACDT","Australian Central Standard Time":"ACST","Australian Central Western Daylight Time":"ACWDT","Australian Central Western Standard Time":"ACWST","Australian Eastern Daylight Time":"AEDT","Australian Eastern Standard Time":"AEST","Australian Western Daylight Time":"AWDT","Australian Western Standard Time":"AWST","Azerbaijan Standard Time":"AZT","Azerbaijan Summer Time":"AZST","Azores Standard Time":"AZOT","Azores Summer Time":"AZOST","Bangladesh Standard Time":"BST","Bangladesh Summer Time":"BDST","Bhutan Time":"BTT","Bolivia Time":"BOT","Brasilia Standard Time":"BRT","Brasilia Summer Time":"BRST","British Summer Time":"BST","Brunei Time":"BNT","Cape Verde Standard Time":"CVT","Casey Time":"CAST","Central Africa Time":"CAT","Central Daylight Time":"CDT","Central European Standard Time":"CET","Central European Summer Time":"CEST","Central Indonesia Time":"WITA","Central Standard Time":"CST","Chamorro Standard Time":"ChST","Chatham Daylight Time":"CHADT","Chatham Standard Time":"CHAST","Chile Standard Time":"CLT","Chile Summer Time":"CLST","China Daylight Time":"CDT","China Standard Time":"CST","Christmas Island Time":"CXT","Chuuk Time":"CHUT","Cocos Islands Time":"CCT","Colombia Standard Time":"COT","Colombia Summer Time":"COST","Cook Islands Standard Time":"CKT","Cook Islands Summer Time":"CKST","Coordinated Universal Time":"UTC","Cuba Daylight Time":"CDT","Cuba Standard Time":"CST","Davis Time":"DAVT","Dumont d’Urville Time":"DDUT","East Africa Time":"EAT","East Greenland Standard Time":"EGT","East Greenland Summer Time":"EGST","East Kazakhstan Time":"ALMT","Easter Island Standard Time":"EAST","Easter Island Summer Time":"EASST","Eastern Daylight Time":"EDT","Eastern European Standard Time":"EET","Eastern European Summer Time":"EEST","Eastern Indonesia Time":"WIT","Eastern Standard Time":"EST","Ecuador Time":"ECT","Falkland Islands Standard Time":"FKST","Falkland Islands Summer Time":"FKST","Fernando de Noronha Standard Time":"FNT","Fernando de Noronha Summer Time":"FNST","Fiji Standard Time":"FJT","Fiji Summer Time":"FJST","French Guiana Time":"GFT","French Southern & Antarctic Time":"TFT","Further-eastern European Time":"FET","Galapagos Time":"GALT","Gambier Time":"GAMT","Georgia Standard Time":"GET","Georgia Summer Time":"GEST","Gilbert Islands Time":"GILT","Greenland Standard Time":"GT","Greenland Summer Time":"GST","Greenwich Mean Time":"GMT","Guam Standard Time":"ChST","Gulf Standard Time":"GST","Guyana Time":"GYT","Hawaii-Aleutian Daylight Time":"HADT","Hawaii-Aleutian Standard Time":"HAST","Hong Kong Standard Time":"HKT","Hong Kong Summer Time":"HKST","Hovd Standard Time":"HOVT","Hovd Summer Time":"HOVST","India Standard Time":"IST","Indian Ocean Time":"IOT","Indochina Time":"ICT","Iran Daylight Time":"IRDT","Iran Standard Time":"IRST","Irish Standard Time":"IST","Irkutsk Standard Time":"IRKT","Irkutsk Summer Time":"IRKST","Israel Daylight Time":"IDT","Israel Standard Time":"IST","Japan Standard Time":"JST","Kamchatka Standard Time":"PETT","Kamchatka Summer Time":"PETST","Kazakhstan Time":"KZT","Korean Daylight Time":"KDT","Korean Standard Time":"KST","Kosrae Time":"KOST","Krasnoyarsk Standard Time":"KRAT","Krasnoyarsk Summer Time":"KRAST","Kyrgyzstan Time":"KGT","Lanka Time":"LKT","Line Islands Time":"LINT","Lord Howe Daylight Time":"LHDT","Lord Howe Standard Time":"LHST","Macao Standard Time":"CST","Macao Summer Time":"CST","Magadan Standard Time":"MAGT","Magadan Summer Time":"MAGST","Malaysia Time":"MYT","Maldives Time":"MVT","Marquesas Time":"MART","Marshall Islands Time":"MHT","Mauritius Standard Time":"MUT","Mauritius Summer Time":"MUST","Mawson Time":"MAWT","Mexican Pacific Daylight Time":"PDT","Mexican Pacific Standard Time":"PST","Moscow Standard Time":"MSK","Moscow Summer Time":"MSD","Mountain Daylight Time":"MDT","Mountain Standard Time":"MST","Myanmar Time":"MMT","Nauru Time":"NRT","Nepal Time":"NPT","New Caledonia Standard Time":"NCT","New Caledonia Summer Time":"NCST","New Zealand Daylight Time":"NZDT","New Zealand Standard Time":"NZST","Newfoundland Daylight Time":"NDT","Newfoundland Standard Time":"NST","Niue Time":"NUT","Norfolk Island Daylight Time":"NFDT","Norfolk Island Standard Time":"NFT","North Korea Time":"KST","Northern Mariana Islands Time":"CHST","Novosibirsk Standard Time":"NOVT","Novosibirsk Summer Time":"NOVST","Omsk Standard Time":"OMST","Omsk Summer Time":"OMSST","Pacific Daylight Time":"PDT","Pacific Standard Time":"PST","Pakistan Standard Time":"PKT","Pakistan Summer Time":"PKST","Palau Time":"PWT","Papua New Guinea Time":"PGT","Paraguay Standard Time":"PYT","Paraguay Summer Time":"PYST","Peru Standard Time":"PET","Peru Summer Time":"PEST","Philippine Standard Time":"PST","Philippine Summer Time":"PHST","Phoenix Islands Time":"PHOT","Pitcairn Time":"PIT","Pohnpei Time":"PONT","Qyzylorda Standard Time":"QYZT","Qyzylorda Summer Time":"QYZST","
|
|
1
|
+
var a={"Acre Standard Time":"ACT","Acre Summer Time":"ACST","Afghanistan Time":"AFT","Alaska Daylight Time":"AKDT","Alaska Standard Time":"AKST","Almaty Standard Time":"ALMT","Almaty Summer Time":"ALMST","Amazon Standard Time":"AMT","Amazon Summer Time":"AMST","American Samoa Standard Time":"SST","Anadyr Standard Time":"ANAT","Anadyr Summer Time":"ANAST","Aqtau Standard Time":"AQTT","Aqtau Summer Time":"AQTST","Aqtobe Standard Time":"AQTT","Aqtobe Summer Time":"AQTST","Arabian Daylight Time":"ADT","Arabian Standard Time":"AST","Argentina Standard Time":"ART","Argentina Summer Time":"ARST","Armenia Standard Time":"AMT","Armenia Summer Time":"AMST","Atlantic Daylight Time":"ADT","Atlantic Standard Time":"AST","Australian Central Daylight Time":"ACDT","Australian Central Standard Time":"ACST","Australian Central Western Daylight Time":"ACWDT","Australian Central Western Standard Time":"ACWST","Australian Eastern Daylight Time":"AEDT","Australian Eastern Standard Time":"AEST","Australian Western Daylight Time":"AWDT","Australian Western Standard Time":"AWST","Azerbaijan Standard Time":"AZT","Azerbaijan Summer Time":"AZST","Azores Standard Time":"AZOT","Azores Summer Time":"AZOST","Bangladesh Standard Time":"BST","Bangladesh Summer Time":"BDST","Bhutan Time":"BTT","Bolivia Time":"BOT","Brasilia Standard Time":"BRT","Brasilia Summer Time":"BRST","British Summer Time":"BST","Brunei Time":"BNT","Cape Verde Standard Time":"CVT","Casey Time":"CAST","Central Africa Time":"CAT","Central Daylight Time":"CDT","Central European Standard Time":"CET","Central European Summer Time":"CEST","Central Indonesia Time":"WITA","Central Standard Time":"CST","Chamorro Standard Time":"ChST","Chatham Daylight Time":"CHADT","Chatham Standard Time":"CHAST","Chile Standard Time":"CLT","Chile Summer Time":"CLST","China Daylight Time":"CDT","China Standard Time":"CST","Christmas Island Time":"CXT","Chuuk Time":"CHUT","Cocos Islands Time":"CCT","Colombia Standard Time":"COT","Colombia Summer Time":"COST","Cook Islands Standard Time":"CKT","Cook Islands Summer Time":"CKST","Coordinated Universal Time":"UTC","Cuba Daylight Time":"CDT","Cuba Standard Time":"CST","Davis Time":"DAVT","Dumont d’Urville Time":"DDUT","East Africa Time":"EAT","East Greenland Standard Time":"EGT","East Greenland Summer Time":"EGST","East Kazakhstan Time":"ALMT","Easter Island Standard Time":"EAST","Easter Island Summer Time":"EASST","Eastern Daylight Time":"EDT","Eastern European Standard Time":"EET","Eastern European Summer Time":"EEST","Eastern Indonesia Time":"WIT","Eastern Standard Time":"EST","Ecuador Time":"ECT","Falkland Islands Standard Time":"FKST","Falkland Islands Summer Time":"FKST","Fernando de Noronha Standard Time":"FNT","Fernando de Noronha Summer Time":"FNST","Fiji Standard Time":"FJT","Fiji Summer Time":"FJST","French Guiana Time":"GFT","French Southern & Antarctic Time":"TFT","Further-eastern European Time":"FET","Galapagos Time":"GALT","Gambier Time":"GAMT","Georgia Standard Time":"GET","Georgia Summer Time":"GEST","Gilbert Islands Time":"GILT","Greenland Standard Time":"GT","Greenland Summer Time":"GST","Greenwich Mean Time":"GMT","Guam Standard Time":"ChST","Gulf Standard Time":"GST","Guyana Time":"GYT","Hawaii-Aleutian Daylight Time":"HADT","Hawaii-Aleutian Standard Time":"HAST","Hong Kong Standard Time":"HKT","Hong Kong Summer Time":"HKST","Hovd Standard Time":"HOVT","Hovd Summer Time":"HOVST","India Standard Time":"IST","Indian Ocean Time":"IOT","Indochina Time":"ICT","Iran Daylight Time":"IRDT","Iran Standard Time":"IRST","Irish Standard Time":"IST","Irkutsk Standard Time":"IRKT","Irkutsk Summer Time":"IRKST","Israel Daylight Time":"IDT","Israel Standard Time":"IST","Japan Standard Time":"JST","Kamchatka Standard Time":"PETT","Kamchatka Summer Time":"PETST","Kazakhstan Time":"KZT","Korean Daylight Time":"KDT","Korean Standard Time":"KST","Kosrae Time":"KOST","Krasnoyarsk Standard Time":"KRAT","Krasnoyarsk Summer Time":"KRAST","Kyrgyzstan Time":"KGT","Lanka Time":"LKT","Line Islands Time":"LINT","Lord Howe Daylight Time":"LHDT","Lord Howe Standard Time":"LHST","Macao Standard Time":"CST","Macao Summer Time":"CST","Magadan Standard Time":"MAGT","Magadan Summer Time":"MAGST","Malaysia Time":"MYT","Maldives Time":"MVT","Marquesas Time":"MART","Marshall Islands Time":"MHT","Mauritius Standard Time":"MUT","Mauritius Summer Time":"MUST","Mawson Time":"MAWT","Mexican Pacific Daylight Time":"PDT","Mexican Pacific Standard Time":"PST","Moscow Standard Time":"MSK","Moscow Summer Time":"MSD","Mountain Daylight Time":"MDT","Mountain Standard Time":"MST","Myanmar Time":"MMT","Nauru Time":"NRT","Nepal Time":"NPT","New Caledonia Standard Time":"NCT","New Caledonia Summer Time":"NCST","New Zealand Daylight Time":"NZDT","New Zealand Standard Time":"NZST","Newfoundland Daylight Time":"NDT","Newfoundland Standard Time":"NST","Niue Time":"NUT","Norfolk Island Daylight Time":"NFDT","Norfolk Island Standard Time":"NFT","North Korea Time":"KST","Northern Mariana Islands Time":"CHST","Novosibirsk Standard Time":"NOVT","Novosibirsk Summer Time":"NOVST","Omsk Standard Time":"OMST","Omsk Summer Time":"OMSST","Pacific Daylight Time":"PDT","Pacific Standard Time":"PST","Pakistan Standard Time":"PKT","Pakistan Summer Time":"PKST","Palau Time":"PWT","Papua New Guinea Time":"PGT","Paraguay Standard Time":"PYT","Paraguay Summer Time":"PYST","Peru Standard Time":"PET","Peru Summer Time":"PEST","Philippine Standard Time":"PST","Philippine Summer Time":"PHST","Phoenix Islands Time":"PHOT","Pitcairn Time":"PIT","Pohnpei Time":"PONT","Qyzylorda Standard Time":"QYZT","Qyzylorda Summer Time":"QYZST","Réunion Time":"RET","Rothera Time":"ROTT","Sakhalin Standard Time":"SAKT","Sakhalin Summer Time":"SAKST","Samara Standard Time":"SAMT","Samara Summer Time":"SAMST","Samoa Daylight Time":"SDT","Samoa Standard Time":"SST","Seychelles Time":"SCT","Singapore Standard Time":"SGT","Solomon Islands Time":"SBT","South Africa Standard Time":"SAST","South Georgia Time":"GST","St. Pierre & Miquelon Daylight Time":"PMDT","St. Pierre & Miquelon Standard Time":"PMST","Suriname Time":"SRT","Syowa Time":"SYOT","Tahiti Time":"TAHT","Taiwan Daylight Time":"CDT","Taiwan Standard Time":"CST","Tajikistan Time":"TJT","Timor-Leste Time":"TLT","Tokelau Time":"TKT","Tonga Standard Time":"TOT","Tonga Summer Time":"TOST","Turkmenistan Standard Time":"TMT","Tuvalu Time":"TVT","Ulaanbaatar Standard Time":"ULAT","Ulaanbaatar Summer Time":"ULAST","Uruguay Standard Time":"UYT","Uruguay Summer Time":"UYST","Uzbekistan Standard Time":"UZT","Uzbekistan Summer Time":"UZST","Vanuatu Standard Time":"VUT","Vanuatu Summer Time":"VUST","Venezuela Time":"VET","Vladivostok Standard Time":"VLAT","Vladivostok Summer Time":"VLAST","Volgograd Standard Time":"VOLT","Volgograd Summer Time":"VOLST","Vostok Time":"VOST","Wake Island Time":"WAKT","Wallis & Futuna Time":"WFT","West Africa Standard Time":"WAT","West Africa Summer Time":"WAST","West Greenland Standard Time":"WGT","West Greenland Summer Time":"WGST","West Kazakhstan Time":"AQTT","Western Argentina Standard Time":"ART","Western Argentina Summer Time":"ARST","Western European Standard Time":"WET","Western European Summer Time":"WEST","Western Indonesia Time":"WIB","Yakutsk Standard Time":"YAKT","Yakutsk Summer Time":"YAKST","Yekaterinburg Standard Time":"YEKT","Yekaterinburg Summer Time":"YEKST","Yukon Time":"YT"};class e{}const T=a=>!!a&&"object"==typeof a&&"zone_name"in a&&"gmt_offset"in a,i=(a,e)=>{const T=new Intl.DateTimeFormat("en-US",{timeZone:e??void 0,timeZoneName:"long"}).formatToParts(a);return T.find(a=>"timeZoneName"===a.type)?.value.replace(/^GMT[+-].+$/,"")??""};const m=new class extends e{z(e,m){const n=T(m.timeZone)?m.timeZone.zone_name:m.timeZone;return((e,T)=>a[i(e,T)]||"")(e.getTime(),n)}zz(a,e){const m=T(e.timeZone)?e.timeZone.zone_name:e.timeZone;return i(a.getTime(),m)}};export{m as formatter};
|