@wikicasa-dev/utilities 1.1.4 → 1.1.5
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/DateUtils.cjs +1 -1
- package/dist/DateUtils.js +72 -72
- package/package.json +1 -1
package/dist/DateUtils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(r){const e=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&e==="[object Date]"?new r.constructor(+r):typeof r=="number"||e==="[object Number]"||typeof r=="string"||e==="[object String]"?new Date(r):new Date(NaN)}function m(r,e){return r instanceof Date?new r.constructor(e):new Date(e)}function G(r,e){const t=p(r);return isNaN(e)?m(r,NaN):(e&&t.setDate(t.getDate()+e),t)}const te=6048e5,me=864e5,we=6e4,ye=36e5,ge=1e3;let be={};function _(){return be}function O(r,e){const t=_(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,a=p(r),s=a.getDay(),o=(s<n?7:0)+s-n;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function W(r){return O(r,{weekStartsOn:1})}function ne(r){const e=p(r),t=e.getFullYear(),n=m(r,0);n.setFullYear(t+1,0,4),n.setHours(0,0,0,0);const a=W(n),s=m(r,0);s.setFullYear(t,0,4),s.setHours(0,0,0,0);const o=W(s);return e.getTime()>=a.getTime()?t+1:e.getTime()>=o.getTime()?t:t-1}function J(r){const e=p(r);return e.setHours(0,0,0,0),e}function F(r){const e=p(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}function pe(r,e){const t=J(r),n=J(e),a=+t-F(t),s=+n-F(n);return Math.round((a-s)/me)}function xe(r){const e=ne(r),t=m(r,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),W(t)}function Me(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function re(r){if(!Me(r)&&typeof r!="number")return!1;const e=p(r);return!isNaN(Number(e))}function De(r){const e=p(r),t=m(r,0);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}const Pe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Te=(r,e,t)=>{let n;const a=Pe[r];return typeof a=="string"?n=a:e===1?n=a.one:n=a.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function Q(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const ke={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Oe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ye={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ve={date:Q({formats:ke,defaultWidth:"full"}),time:Q({formats:Oe,defaultWidth:"full"}),dateTime:Q({formats:Ye,defaultWidth:"full"})},Ee={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},We=(r,e,t,n)=>Ee[r];function q(r){return(e,t)=>{const n=t?.context?String(t.context):"standalone";let a;if(n==="formatting"&&r.formattingValues){const o=r.defaultFormattingWidth||r.defaultWidth,d=t?.width?String(t.width):o;a=r.formattingValues[d]||r.formattingValues[o]}else{const o=r.defaultWidth,d=t?.width?String(t.width):r.defaultWidth;a=r.values[d]||r.values[o]}const s=r.argumentCallback?r.argumentCallback(e):e;return a[s]}}const _e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ne={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},qe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},He={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Fe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Ce={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Le=(r,e)=>{const t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},Ie={ordinalNumber:Le,era:q({values:_e,defaultWidth:"wide"}),quarter:q({values:Ne,defaultWidth:"wide",argumentCallback:r=>r-1}),month:q({values:qe,defaultWidth:"wide"}),day:q({values:He,defaultWidth:"wide"}),dayPeriod:q({values:Fe,defaultWidth:"wide",formattingValues:Ce,defaultFormattingWidth:"wide"})};function H(r){return(e,t={})=>{const n=t.width,a=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],s=e.match(a);if(!s)return null;const o=s[0],d=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],M=Array.isArray(d)?Re(d,f=>f.test(o)):Qe(d,f=>f.test(o));let x;x=r.valueCallback?r.valueCallback(M):M,x=t.valueCallback?t.valueCallback(x):x;const b=e.slice(o.length);return{value:x,rest:b}}}function Qe(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function Re(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function Xe(r){return(e,t={})=>{const n=e.match(r.matchPattern);if(!n)return null;const a=n[0],s=e.match(r.parsePattern);if(!s)return null;let o=r.valueCallback?r.valueCallback(s[0]):s[0];o=t.valueCallback?t.valueCallback(o):o;const d=e.slice(a.length);return{value:o,rest:d}}}const Ge=/^(\d+)(th|st|nd|rd)?/i,Be=/\d+/i,Ae={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$e={any:[/^b/i,/^(a|c)/i]},je={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ve={any:[/1/i,/2/i,/3/i,/4/i]},Ze={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},ze={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Je={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Ke={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Ue={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Se={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},et={ordinalNumber:Xe({matchPattern:Ge,parsePattern:Be,valueCallback:r=>parseInt(r,10)}),era:H({matchPatterns:Ae,defaultMatchWidth:"wide",parsePatterns:$e,defaultParseWidth:"any"}),quarter:H({matchPatterns:je,defaultMatchWidth:"wide",parsePatterns:Ve,defaultParseWidth:"any",valueCallback:r=>r+1}),month:H({matchPatterns:Ze,defaultMatchWidth:"wide",parsePatterns:ze,defaultParseWidth:"any"}),day:H({matchPatterns:Je,defaultMatchWidth:"wide",parsePatterns:Ke,defaultParseWidth:"any"}),dayPeriod:H({matchPatterns:Ue,defaultMatchWidth:"any",parsePatterns:Se,defaultParseWidth:"any"})},ae={code:"en-US",formatDistance:Te,formatLong:ve,formatRelative:We,localize:Ie,match:et,options:{weekStartsOn:0,firstWeekContainsDate:1}};function tt(r){const e=p(r);return pe(e,De(e))+1}function se(r){const e=p(r),t=+W(e)-+xe(e);return Math.round(t/te)+1}function B(r,e){const t=p(r),n=t.getFullYear(),a=_(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=m(r,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const d=O(o,e),M=m(r,0);M.setFullYear(n,0,s),M.setHours(0,0,0,0);const x=O(M,e);return t.getTime()>=d.getTime()?n+1:t.getTime()>=x.getTime()?n:n-1}function nt(r,e){const t=_(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,a=B(r,e),s=m(r,0);return s.setFullYear(a,0,n),s.setHours(0,0,0,0),O(s,e)}function oe(r,e){const t=p(r),n=+O(t,e)-+nt(t,e);return Math.round(n/te)+1}function c(r,e){const t=r<0?"-":"",n=Math.abs(r).toString().padStart(e,"0");return t+n}const k={y(r,e){const t=r.getFullYear(),n=t>0?t:1-t;return c(e==="yy"?n%100:n,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):c(t+1,2)},d(r,e){return c(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(r,e){return c(r.getHours()%12||12,e.length)},H(r,e){return c(r.getHours(),e.length)},m(r,e){return c(r.getMinutes(),e.length)},s(r,e){return c(r.getSeconds(),e.length)},S(r,e){const t=e.length,n=r.getMilliseconds(),a=Math.trunc(n*Math.pow(10,t-3));return c(a,e.length)}},E={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},K={G:function(r,e,t){const n=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const n=r.getFullYear(),a=n>0?n:1-n;return t.ordinalNumber(a,{unit:"year"})}return k.y(r,e)},Y:function(r,e,t,n){const a=B(r,n),s=a>0?a:1-a;if(e==="YY"){const o=s%100;return c(o,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):c(s,e.length)},R:function(r,e){const t=ne(r);return c(t,e.length)},u:function(r,e){const t=r.getFullYear();return c(t,e.length)},Q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return c(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return c(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){const n=r.getMonth();switch(e){case"M":case"MM":return k.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){const n=r.getMonth();switch(e){case"L":return String(n+1);case"LL":return c(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){const a=oe(r,n);return e==="wo"?t.ordinalNumber(a,{unit:"week"}):c(a,e.length)},I:function(r,e,t){const n=se(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):c(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):k.d(r,e)},D:function(r,e,t){const n=tt(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):c(n,e.length)},E:function(r,e,t){const n=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return c(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(a,{width:"short",context:"formatting"});case"eeee":default:return t.day(a,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return c(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(a,{width:"narrow",context:"standalone"});case"cccccc":return t.day(a,{width:"short",context:"standalone"});case"cccc":default:return t.day(a,{width:"wide",context:"standalone"})}},i:function(r,e,t){const n=r.getDay(),a=n===0?7:n;switch(e){case"i":return String(a);case"ii":return c(a,e.length);case"io":return t.ordinalNumber(a,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){const a=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(r,e,t){const n=r.getHours();let a;switch(n===12?a=E.noon:n===0?a=E.midnight:a=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(r,e,t){const n=r.getHours();let a;switch(n>=17?a=E.evening:n>=12?a=E.afternoon:n>=4?a=E.morning:a=E.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let n=r.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return k.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):k.H(r,e)},K:function(r,e,t){const n=r.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):c(n,e.length)},k:function(r,e,t){let n=r.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):c(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):k.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):k.s(r,e)},S:function(r,e){return k.S(r,e)},X:function(r,e,t){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return S(n);case"XXXX":case"XX":return Y(n);case"XXXXX":case"XXX":default:return Y(n,":")}},x:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"x":return S(n);case"xxxx":case"xx":return Y(n);case"xxxxx":case"xxx":default:return Y(n,":")}},O:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+U(n,":");case"OOOO":default:return"GMT"+Y(n,":")}},z:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+U(n,":");case"zzzz":default:return"GMT"+Y(n,":")}},t:function(r,e,t){const n=Math.trunc(r.getTime()/1e3);return c(n,e.length)},T:function(r,e,t){const n=r.getTime();return c(n,e.length)}};function U(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Math.trunc(n/60),s=n%60;return s===0?t+String(a):t+String(a)+e+c(s,2)}function S(r,e){return r%60===0?(r>0?"-":"+")+c(Math.abs(r)/60,2):Y(r,e)}function Y(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=c(Math.trunc(n/60),2),s=c(n%60,2);return t+a+e+s}const ee=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},ie=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},rt=(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],n=t[1],a=t[2];if(!a)return ee(r,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",ee(n,e)).replace("{{time}}",ie(a,e))},R={p:ie,P:rt},at=/^D+$/,st=/^Y+$/,ot=["D","DD","YY","YYYY"];function ue(r){return at.test(r)}function ce(r){return st.test(r)}function X(r,e,t){const n=it(r,e,t);if(console.warn(n),ot.includes(r))throw new RangeError(n)}function it(r,e,t){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ut=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ct=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,dt=/^'([^]*?)'?$/,lt=/''/g,ft=/[a-zA-Z]/;function C(r,e,t){const n=_(),a=n.locale??ae,s=n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=n.weekStartsOn??n.locale?.options?.weekStartsOn??0,d=p(r);if(!re(d))throw new RangeError("Invalid time value");let M=e.match(ct).map(b=>{const f=b[0];if(f==="p"||f==="P"){const N=R[f];return N(b,a.formatLong)}return b}).join("").match(ut).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const f=b[0];if(f==="'")return{isToken:!1,value:ht(b)};if(K[f])return{isToken:!0,value:b};if(f.match(ft))throw new RangeError("Format string contains an unescaped latin alphabet character `"+f+"`");return{isToken:!1,value:b}});a.localize.preprocessor&&(M=a.localize.preprocessor(d,M));const x={firstWeekContainsDate:s,weekStartsOn:o,locale:a};return M.map(b=>{if(!b.isToken)return b.value;const f=b.value;(ce(f)||ue(f))&&X(f,e,String(r));const N=K[f[0]];return N(d,f,a.localize,x)}).join("")}function ht(r){const e=r.match(dt);return e?e[1].replace(lt,"'"):r}function mt(){return Object.assign({},_())}function wt(r){let t=p(r).getDay();return t===0&&(t=7),t}function yt(r,e){const t=e instanceof Date?m(e,0):new e(0);return t.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),t.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),t}const gt=10;class de{subPriority=0;validate(e,t){return!0}}class bt extends de{constructor(e,t,n,a,s){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=a,s&&(this.subPriority=s)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}}class pt extends de{priority=gt;subPriority=-1;set(e,t){return t.timestampIsSet?e:m(e,yt(e,Date))}}class u{run(e,t,n,a){const s=this.parse(e,t,n,a);return s?{setter:new bt(s.value,this.validate,this.set,this.priority,this.subPriority),rest:s.rest}:null}validate(e,t,n){return!0}}class xt extends u{priority=140;parse(e,t,n){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});case"GGGG":default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]}const y={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},P={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function g(r,e){return r&&{value:e(r.value),rest:r.rest}}function l(r,e){const t=e.match(r);return t?{value:parseInt(t[0],10),rest:e.slice(t[0].length)}:null}function T(r,e){const t=e.match(r);if(!t)return null;if(t[0]==="Z")return{value:0,rest:e.slice(1)};const n=t[1]==="+"?1:-1,a=t[2]?parseInt(t[2],10):0,s=t[3]?parseInt(t[3],10):0,o=t[5]?parseInt(t[5],10):0;return{value:n*(a*ye+s*we+o*ge),rest:e.slice(t[0].length)}}function le(r){return l(y.anyDigitsSigned,r)}function w(r,e){switch(r){case 1:return l(y.singleDigit,e);case 2:return l(y.twoDigits,e);case 3:return l(y.threeDigits,e);case 4:return l(y.fourDigits,e);default:return l(new RegExp("^\\d{1,"+r+"}"),e)}}function L(r,e){switch(r){case 1:return l(y.singleDigitSigned,e);case 2:return l(y.twoDigitsSigned,e);case 3:return l(y.threeDigitsSigned,e);case 4:return l(y.fourDigitsSigned,e);default:return l(new RegExp("^-?\\d{1,"+r+"}"),e)}}function A(r){switch(r){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function fe(r,e){const t=e>0,n=t?e:1-e;let a;if(n<=50)a=r||100;else{const s=n+50,o=Math.trunc(s/100)*100,d=r>=s%100;a=r+o-(d?100:0)}return t?a:1-a}function he(r){return r%400===0||r%4===0&&r%100!==0}class Mt extends u{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,n){const a=s=>({year:s,isTwoDigitYear:t==="yy"});switch(t){case"y":return g(w(4,e),a);case"yo":return g(n.ordinalNumber(e,{unit:"year"}),a);default:return g(w(t.length,e),a)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){const a=e.getFullYear();if(n.isTwoDigitYear){const o=fe(n.year,a);return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}const s=!("era"in t)||t.era===1?n.year:1-n.year;return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}class Dt extends u{priority=130;parse(e,t,n){const a=s=>({year:s,isTwoDigitYear:t==="YY"});switch(t){case"Y":return g(w(4,e),a);case"Yo":return g(n.ordinalNumber(e,{unit:"year"}),a);default:return g(w(t.length,e),a)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,a){const s=B(e,a);if(n.isTwoDigitYear){const d=fe(n.year,s);return e.setFullYear(d,0,a.firstWeekContainsDate),e.setHours(0,0,0,0),O(e,a)}const o=!("era"in t)||t.era===1?n.year:1-n.year;return e.setFullYear(o,0,a.firstWeekContainsDate),e.setHours(0,0,0,0),O(e,a)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class Pt extends u{priority=130;parse(e,t){return L(t==="R"?4:t.length,e)}set(e,t,n){const a=m(e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),W(a)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class Tt extends u{priority=130;parse(e,t){return L(t==="u"?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class kt extends u{priority=120;parse(e,t,n){switch(t){case"Q":case"QQ":return w(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class Ot extends u{priority=120;parse(e,t,n){switch(t){case"q":case"qq":return w(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class Yt extends u{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,n){const a=s=>s-1;switch(t){case"M":return g(l(y.month,e),a);case"MM":return g(w(2,e),a);case"Mo":return g(n.ordinalNumber(e,{unit:"month"}),a);case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}}class vt extends u{priority=110;parse(e,t,n){const a=s=>s-1;switch(t){case"L":return g(l(y.month,e),a);case"LL":return g(w(2,e),a);case"Lo":return g(n.ordinalNumber(e,{unit:"month"}),a);case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function Et(r,e,t){const n=p(r),a=oe(n,t)-e;return n.setDate(n.getDate()-a*7),n}class Wt extends u{priority=100;parse(e,t,n){switch(t){case"w":return l(y.week,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,a){return O(Et(e,n,a),a)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function _t(r,e){const t=p(r),n=se(t)-e;return t.setDate(t.getDate()-n*7),t}class Nt extends u{priority=100;parse(e,t,n){switch(t){case"I":return l(y.week,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return W(_t(e,n))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const qt=[31,28,31,30,31,30,31,31,30,31,30,31],Ht=[31,29,31,30,31,30,31,31,30,31,30,31];class Ft extends u{priority=90;subPriority=1;parse(e,t,n){switch(t){case"d":return l(y.date,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return w(t.length,e)}}validate(e,t){const n=e.getFullYear(),a=he(n),s=e.getMonth();return a?t>=1&&t<=Ht[s]:t>=1&&t<=qt[s]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class Ct extends u{priority=90;subpriority=1;parse(e,t,n){switch(t){case"D":case"DD":return l(y.dayOfYear,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return w(t.length,e)}}validate(e,t){const n=e.getFullYear();return he(n)?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function $(r,e,t){const n=_(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=p(r),o=s.getDay(),M=(e%7+7)%7,x=7-a,b=e<0||e>6?e-(o+x)%7:(M+x)%7-(o+x)%7;return G(s,b)}class Lt extends u{priority=90;parse(e,t,n){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=$(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]}class It extends u{priority=90;parse(e,t,n,a){const s=o=>{const d=Math.floor((o-1)/7)*7;return(o+a.weekStartsOn+6)%7+d};switch(t){case"e":case"ee":return g(w(t.length,e),s);case"eo":return g(n.ordinalNumber(e,{unit:"day"}),s);case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=$(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class Qt extends u{priority=90;parse(e,t,n,a){const s=o=>{const d=Math.floor((o-1)/7)*7;return(o+a.weekStartsOn+6)%7+d};switch(t){case"c":case"cc":return g(w(t.length,e),s);case"co":return g(n.ordinalNumber(e,{unit:"day"}),s);case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=$(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function Rt(r,e){const t=p(r),n=wt(t),a=e-n;return G(t,a)}class Xt extends u{priority=90;parse(e,t,n){const a=s=>s===0?7:s;switch(t){case"i":case"ii":return w(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return g(n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiii":return g(n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiiii":return g(n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiii":default:return g(n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=Rt(e,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class Gt extends u{priority=80;parse(e,t,n){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(A(n),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]}class Bt extends u{priority=80;parse(e,t,n){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(A(n),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]}class At extends u{priority=80;parse(e,t,n){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(A(n),0,0,0),e}incompatibleTokens=["a","b","t","T"]}class $t extends u{priority=70;parse(e,t,n){switch(t){case"h":return l(y.hour12h,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){const a=e.getHours()>=12;return a&&n<12?e.setHours(n+12,0,0,0):!a&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]}class jt extends u{priority=70;parse(e,t,n){switch(t){case"H":return l(y.hour23h,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]}class Vt extends u{priority=70;parse(e,t,n){switch(t){case"K":return l(y.hour11h,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]}class Zt extends u{priority=70;parse(e,t,n){switch(t){case"k":return l(y.hour24h,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){const a=n<=24?n%24:n;return e.setHours(a,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]}class zt extends u{priority=60;parse(e,t,n){switch(t){case"m":return l(y.minute,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=["t","T"]}class Jt extends u{priority=50;parse(e,t,n){switch(t){case"s":return l(y.second,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=["t","T"]}class Kt extends u{priority=30;parse(e,t){const n=a=>Math.trunc(a*Math.pow(10,-t.length+3));return g(w(t.length,e),n)}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=["t","T"]}class Ut extends u{priority=10;parse(e,t){switch(t){case"X":return T(P.basicOptionalMinutes,e);case"XX":return T(P.basic,e);case"XXXX":return T(P.basicOptionalSeconds,e);case"XXXXX":return T(P.extendedOptionalSeconds,e);case"XXX":default:return T(P.extended,e)}}set(e,t,n){return t.timestampIsSet?e:m(e,e.getTime()-F(e)-n)}incompatibleTokens=["t","T","x"]}class St extends u{priority=10;parse(e,t){switch(t){case"x":return T(P.basicOptionalMinutes,e);case"xx":return T(P.basic,e);case"xxxx":return T(P.basicOptionalSeconds,e);case"xxxxx":return T(P.extendedOptionalSeconds,e);case"xxx":default:return T(P.extended,e)}}set(e,t,n){return t.timestampIsSet?e:m(e,e.getTime()-F(e)-n)}incompatibleTokens=["t","T","X"]}class en extends u{priority=40;parse(e){return le(e)}set(e,t,n){return[m(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"}class tn extends u{priority=20;parse(e){return le(e)}set(e,t,n){return[m(e,n),{timestampIsSet:!0}]}incompatibleTokens="*"}const nn={G:new xt,y:new Mt,Y:new Dt,R:new Pt,u:new Tt,Q:new kt,q:new Ot,M:new Yt,L:new vt,w:new Wt,I:new Nt,d:new Ft,D:new Ct,E:new Lt,e:new It,c:new Qt,i:new Xt,a:new Gt,b:new Bt,B:new At,h:new $t,H:new jt,K:new Vt,k:new Zt,m:new zt,s:new Jt,S:new Kt,X:new Ut,x:new St,t:new en,T:new tn},rn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,an=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sn=/^'([^]*?)'?$/,on=/''/g,un=/\S/,cn=/[a-zA-Z]/;function dn(r,e,t,n){const a=mt(),s=a.locale??ae,o=a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,d=a.weekStartsOn??a.locale?.options?.weekStartsOn??0;if(e==="")return r===""?p(t):m(t,NaN);const M={firstWeekContainsDate:o,weekStartsOn:d,locale:s},x=[new pt],b=e.match(an).map(i=>{const h=i[0];if(h in R){const D=R[h];return D(i,s.formatLong)}return i}).join("").match(rn),f=[];for(let i of b){ce(i)&&X(i,e,r),ue(i)&&X(i,e,r);const h=i[0],D=nn[h];if(D){const{incompatibleTokens:V}=D;if(Array.isArray(V)){const Z=f.find(z=>V.includes(z.token)||z.token===h);if(Z)throw new RangeError(`The format string mustn't contain \`${Z.fullToken}\` and \`${i}\` at the same time`)}else if(D.incompatibleTokens==="*"&&f.length>0)throw new RangeError(`The format string mustn't contain \`${i}\` and any other token at the same time`);f.push({token:h,fullToken:i});const I=D.run(r,i,s.match,M);if(!I)return m(t,NaN);x.push(I.setter),r=I.rest}else{if(h.match(cn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");if(i==="''"?i="'":h==="'"&&(i=ln(i)),r.indexOf(i)===0)r=r.slice(i.length);else return m(t,NaN)}}if(r.length>0&&un.test(r))return m(t,NaN);const N=x.map(i=>i.priority).sort((i,h)=>h-i).filter((i,h,D)=>D.indexOf(i)===h).map(i=>x.filter(h=>h.priority===i).sort((h,D)=>D.subPriority-h.subPriority)).map(i=>i[0]);let v=p(t);if(isNaN(v.getTime()))return m(t,NaN);const j={};for(const i of N){if(!i.validate(v,M))return m(t,NaN);const h=i.set(v,j,M);Array.isArray(h)?(v=h[0],Object.assign(j,h[1])):v=h}return m(t,v)}function ln(r){return r.match(sn)[1].replace(on,"'")}function fn(r,e){return G(r,-e)}function hn(r,e=!1){const t=r.getDate(),n=r.getMonth()+1,a=r.getFullYear();return e?`${("0"+t).slice(-2)}-${("0"+n).slice(-2)}-${a}`:`${a}-${("0"+n).slice(-2)}-${("0"+t).slice(-2)}`}const mn=r=>{if(typeof r=="string"){const e=new Date(r);return isNaN(e.valueOf())?"":C(e,"dd/MM/yyyy")}return C(r,"dd/MM/yyyy")},wn=(r=new Date,e)=>(e<0&&(e=0),fn(r,e));function yn(r){const t=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy"].map(n=>dn(r,n,new Date)).find(n=>re(n));if(t){const n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0)),a=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59));return{start:C(n,"yyyy-MM-dd'T'HH:mm:ss'Z'"),end:C(a,"yyyy-MM-dd'T'HH:mm:ss'Z'")}}return{start:null,end:null}}exports.formatDate=hn;exports.formatDateToddMMYYYY=mn;exports.getStartAndEndOfDayUTC=yn;exports.subtractDaysFromDate=wn;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(r){const e=Object.prototype.toString.call(r);return r instanceof Date||typeof r=="object"&&e==="[object Date]"?new r.constructor(+r):typeof r=="number"||e==="[object Number]"||typeof r=="string"||e==="[object String]"?new Date(r):new Date(NaN)}function m(r,e){return r instanceof Date?new r.constructor(e):new Date(e)}function X(r,e){const t=p(r);return isNaN(e)?m(r,NaN):(e&&t.setDate(t.getDate()+e),t)}const te=6048e5,me=864e5,we=6e4,ye=36e5,ge=1e3;let be={};function _(){return be}function O(r,e){const t=_(),n=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,a=p(r),s=a.getDay(),o=(s<n?7:0)+s-n;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function W(r){return O(r,{weekStartsOn:1})}function ne(r){const e=p(r),t=e.getFullYear(),n=m(r,0);n.setFullYear(t+1,0,4),n.setHours(0,0,0,0);const a=W(n),s=m(r,0);s.setFullYear(t,0,4),s.setHours(0,0,0,0);const o=W(s);return e.getTime()>=a.getTime()?t+1:e.getTime()>=o.getTime()?t:t-1}function J(r){const e=p(r);return e.setHours(0,0,0,0),e}function F(r){const e=p(r),t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+r-+t}function pe(r,e){const t=J(r),n=J(e),a=+t-F(t),s=+n-F(n);return Math.round((a-s)/me)}function xe(r){const e=ne(r),t=m(r,0);return t.setFullYear(e,0,4),t.setHours(0,0,0,0),W(t)}function Me(r){return r instanceof Date||typeof r=="object"&&Object.prototype.toString.call(r)==="[object Date]"}function re(r){if(!Me(r)&&typeof r!="number")return!1;const e=p(r);return!isNaN(Number(e))}function Pe(r){const e=p(r),t=m(r,0);return t.setFullYear(e.getFullYear(),0,1),t.setHours(0,0,0,0),t}const De={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Te=(r,e,t)=>{let n;const a=De[r];return typeof a=="string"?n=a:e===1?n=a.one:n=a.other.replace("{{count}}",e.toString()),t?.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n};function I(r){return(e={})=>{const t=e.width?String(e.width):r.defaultWidth;return r.formats[t]||r.formats[r.defaultWidth]}}const ke={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Oe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ye={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ve={date:I({formats:ke,defaultWidth:"full"}),time:I({formats:Oe,defaultWidth:"full"}),dateTime:I({formats:Ye,defaultWidth:"full"})},Ee={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},We=(r,e,t,n)=>Ee[r];function q(r){return(e,t)=>{const n=t?.context?String(t.context):"standalone";let a;if(n==="formatting"&&r.formattingValues){const o=r.defaultFormattingWidth||r.defaultWidth,d=t?.width?String(t.width):o;a=r.formattingValues[d]||r.formattingValues[o]}else{const o=r.defaultWidth,d=t?.width?String(t.width):r.defaultWidth;a=r.values[d]||r.values[o]}const s=r.argumentCallback?r.argumentCallback(e):e;return a[s]}}const _e={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Ne={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},qe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},He={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Fe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Le={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Ce=(r,e)=>{const t=Number(r),n=t%100;if(n>20||n<10)switch(n%10){case 1:return t+"st";case 2:return t+"nd";case 3:return t+"rd"}return t+"th"},Ie={ordinalNumber:Ce,era:q({values:_e,defaultWidth:"wide"}),quarter:q({values:Ne,defaultWidth:"wide",argumentCallback:r=>r-1}),month:q({values:qe,defaultWidth:"wide"}),day:q({values:He,defaultWidth:"wide"}),dayPeriod:q({values:Fe,defaultWidth:"wide",formattingValues:Le,defaultFormattingWidth:"wide"})};function H(r){return(e,t={})=>{const n=t.width,a=n&&r.matchPatterns[n]||r.matchPatterns[r.defaultMatchWidth],s=e.match(a);if(!s)return null;const o=s[0],d=n&&r.parsePatterns[n]||r.parsePatterns[r.defaultParseWidth],M=Array.isArray(d)?Re(d,f=>f.test(o)):Qe(d,f=>f.test(o));let x;x=r.valueCallback?r.valueCallback(M):M,x=t.valueCallback?t.valueCallback(x):x;const b=e.slice(o.length);return{value:x,rest:b}}}function Qe(r,e){for(const t in r)if(Object.prototype.hasOwnProperty.call(r,t)&&e(r[t]))return t}function Re(r,e){for(let t=0;t<r.length;t++)if(e(r[t]))return t}function Xe(r){return(e,t={})=>{const n=e.match(r.matchPattern);if(!n)return null;const a=n[0],s=e.match(r.parsePattern);if(!s)return null;let o=r.valueCallback?r.valueCallback(s[0]):s[0];o=t.valueCallback?t.valueCallback(o):o;const d=e.slice(a.length);return{value:o,rest:d}}}const Ge=/^(\d+)(th|st|nd|rd)?/i,Be=/\d+/i,Ae={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$e={any:[/^b/i,/^(a|c)/i]},je={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Ve={any:[/1/i,/2/i,/3/i,/4/i]},ze={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Je={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ze={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Ke={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Ue={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Se={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},et={ordinalNumber:Xe({matchPattern:Ge,parsePattern:Be,valueCallback:r=>parseInt(r,10)}),era:H({matchPatterns:Ae,defaultMatchWidth:"wide",parsePatterns:$e,defaultParseWidth:"any"}),quarter:H({matchPatterns:je,defaultMatchWidth:"wide",parsePatterns:Ve,defaultParseWidth:"any",valueCallback:r=>r+1}),month:H({matchPatterns:ze,defaultMatchWidth:"wide",parsePatterns:Je,defaultParseWidth:"any"}),day:H({matchPatterns:Ze,defaultMatchWidth:"wide",parsePatterns:Ke,defaultParseWidth:"any"}),dayPeriod:H({matchPatterns:Ue,defaultMatchWidth:"any",parsePatterns:Se,defaultParseWidth:"any"})},ae={code:"en-US",formatDistance:Te,formatLong:ve,formatRelative:We,localize:Ie,match:et,options:{weekStartsOn:0,firstWeekContainsDate:1}};function tt(r){const e=p(r);return pe(e,Pe(e))+1}function se(r){const e=p(r),t=+W(e)-+xe(e);return Math.round(t/te)+1}function G(r,e){const t=p(r),n=t.getFullYear(),a=_(),s=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,o=m(r,0);o.setFullYear(n+1,0,s),o.setHours(0,0,0,0);const d=O(o,e),M=m(r,0);M.setFullYear(n,0,s),M.setHours(0,0,0,0);const x=O(M,e);return t.getTime()>=d.getTime()?n+1:t.getTime()>=x.getTime()?n:n-1}function nt(r,e){const t=_(),n=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??t.firstWeekContainsDate??t.locale?.options?.firstWeekContainsDate??1,a=G(r,e),s=m(r,0);return s.setFullYear(a,0,n),s.setHours(0,0,0,0),O(s,e)}function oe(r,e){const t=p(r),n=+O(t,e)-+nt(t,e);return Math.round(n/te)+1}function c(r,e){const t=r<0?"-":"",n=Math.abs(r).toString().padStart(e,"0");return t+n}const k={y(r,e){const t=r.getFullYear(),n=t>0?t:1-t;return c(e==="yy"?n%100:n,e.length)},M(r,e){const t=r.getMonth();return e==="M"?String(t+1):c(t+1,2)},d(r,e){return c(r.getDate(),e.length)},a(r,e){const t=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.toUpperCase();case"aaa":return t;case"aaaaa":return t[0];case"aaaa":default:return t==="am"?"a.m.":"p.m."}},h(r,e){return c(r.getHours()%12||12,e.length)},H(r,e){return c(r.getHours(),e.length)},m(r,e){return c(r.getMinutes(),e.length)},s(r,e){return c(r.getSeconds(),e.length)},S(r,e){const t=e.length,n=r.getMilliseconds(),a=Math.trunc(n*Math.pow(10,t-3));return c(a,e.length)}},E={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Z={G:function(r,e,t){const n=r.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return t.era(n,{width:"abbreviated"});case"GGGGG":return t.era(n,{width:"narrow"});case"GGGG":default:return t.era(n,{width:"wide"})}},y:function(r,e,t){if(e==="yo"){const n=r.getFullYear(),a=n>0?n:1-n;return t.ordinalNumber(a,{unit:"year"})}return k.y(r,e)},Y:function(r,e,t,n){const a=G(r,n),s=a>0?a:1-a;if(e==="YY"){const o=s%100;return c(o,2)}return e==="Yo"?t.ordinalNumber(s,{unit:"year"}):c(s,e.length)},R:function(r,e){const t=ne(r);return c(t,e.length)},u:function(r,e){const t=r.getFullYear();return c(t,e.length)},Q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"Q":return String(n);case"QQ":return c(n,2);case"Qo":return t.ordinalNumber(n,{unit:"quarter"});case"QQQ":return t.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return t.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(n,{width:"wide",context:"formatting"})}},q:function(r,e,t){const n=Math.ceil((r.getMonth()+1)/3);switch(e){case"q":return String(n);case"qq":return c(n,2);case"qo":return t.ordinalNumber(n,{unit:"quarter"});case"qqq":return t.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return t.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(n,{width:"wide",context:"standalone"})}},M:function(r,e,t){const n=r.getMonth();switch(e){case"M":case"MM":return k.M(r,e);case"Mo":return t.ordinalNumber(n+1,{unit:"month"});case"MMM":return t.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return t.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(n,{width:"wide",context:"formatting"})}},L:function(r,e,t){const n=r.getMonth();switch(e){case"L":return String(n+1);case"LL":return c(n+1,2);case"Lo":return t.ordinalNumber(n+1,{unit:"month"});case"LLL":return t.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return t.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(n,{width:"wide",context:"standalone"})}},w:function(r,e,t,n){const a=oe(r,n);return e==="wo"?t.ordinalNumber(a,{unit:"week"}):c(a,e.length)},I:function(r,e,t){const n=se(r);return e==="Io"?t.ordinalNumber(n,{unit:"week"}):c(n,e.length)},d:function(r,e,t){return e==="do"?t.ordinalNumber(r.getDate(),{unit:"date"}):k.d(r,e)},D:function(r,e,t){const n=tt(r);return e==="Do"?t.ordinalNumber(n,{unit:"dayOfYear"}):c(n,e.length)},E:function(r,e,t){const n=r.getDay();switch(e){case"E":case"EE":case"EEE":return t.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return t.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(n,{width:"short",context:"formatting"});case"EEEE":default:return t.day(n,{width:"wide",context:"formatting"})}},e:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"e":return String(s);case"ee":return c(s,2);case"eo":return t.ordinalNumber(s,{unit:"day"});case"eee":return t.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return t.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(a,{width:"short",context:"formatting"});case"eeee":default:return t.day(a,{width:"wide",context:"formatting"})}},c:function(r,e,t,n){const a=r.getDay(),s=(a-n.weekStartsOn+8)%7||7;switch(e){case"c":return String(s);case"cc":return c(s,e.length);case"co":return t.ordinalNumber(s,{unit:"day"});case"ccc":return t.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return t.day(a,{width:"narrow",context:"standalone"});case"cccccc":return t.day(a,{width:"short",context:"standalone"});case"cccc":default:return t.day(a,{width:"wide",context:"standalone"})}},i:function(r,e,t){const n=r.getDay(),a=n===0?7:n;switch(e){case"i":return String(a);case"ii":return c(a,e.length);case"io":return t.ordinalNumber(a,{unit:"day"});case"iii":return t.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return t.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return t.day(n,{width:"short",context:"formatting"});case"iiii":default:return t.day(n,{width:"wide",context:"formatting"})}},a:function(r,e,t){const a=r.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(r,e,t){const n=r.getHours();let a;switch(n===12?a=E.noon:n===0?a=E.midnight:a=n/12>=1?"pm":"am",e){case"b":case"bb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(r,e,t){const n=r.getHours();let a;switch(n>=17?a=E.evening:n>=12?a=E.afternoon:n>=4?a=E.morning:a=E.night,e){case"B":case"BB":case"BBB":return t.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return t.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(r,e,t){if(e==="ho"){let n=r.getHours()%12;return n===0&&(n=12),t.ordinalNumber(n,{unit:"hour"})}return k.h(r,e)},H:function(r,e,t){return e==="Ho"?t.ordinalNumber(r.getHours(),{unit:"hour"}):k.H(r,e)},K:function(r,e,t){const n=r.getHours()%12;return e==="Ko"?t.ordinalNumber(n,{unit:"hour"}):c(n,e.length)},k:function(r,e,t){let n=r.getHours();return n===0&&(n=24),e==="ko"?t.ordinalNumber(n,{unit:"hour"}):c(n,e.length)},m:function(r,e,t){return e==="mo"?t.ordinalNumber(r.getMinutes(),{unit:"minute"}):k.m(r,e)},s:function(r,e,t){return e==="so"?t.ordinalNumber(r.getSeconds(),{unit:"second"}):k.s(r,e)},S:function(r,e){return k.S(r,e)},X:function(r,e,t){const n=r.getTimezoneOffset();if(n===0)return"Z";switch(e){case"X":return U(n);case"XXXX":case"XX":return Y(n);case"XXXXX":case"XXX":default:return Y(n,":")}},x:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"x":return U(n);case"xxxx":case"xx":return Y(n);case"xxxxx":case"xxx":default:return Y(n,":")}},O:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+K(n,":");case"OOOO":default:return"GMT"+Y(n,":")}},z:function(r,e,t){const n=r.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+K(n,":");case"zzzz":default:return"GMT"+Y(n,":")}},t:function(r,e,t){const n=Math.trunc(r.getTime()/1e3);return c(n,e.length)},T:function(r,e,t){const n=r.getTime();return c(n,e.length)}};function K(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=Math.trunc(n/60),s=n%60;return s===0?t+String(a):t+String(a)+e+c(s,2)}function U(r,e){return r%60===0?(r>0?"-":"+")+c(Math.abs(r)/60,2):Y(r,e)}function Y(r,e=""){const t=r>0?"-":"+",n=Math.abs(r),a=c(Math.trunc(n/60),2),s=c(n%60,2);return t+a+e+s}const S=(r,e)=>{switch(r){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},ie=(r,e)=>{switch(r){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},rt=(r,e)=>{const t=r.match(/(P+)(p+)?/)||[],n=t[1],a=t[2];if(!a)return S(r,e);let s;switch(n){case"P":s=e.dateTime({width:"short"});break;case"PP":s=e.dateTime({width:"medium"});break;case"PPP":s=e.dateTime({width:"long"});break;case"PPPP":default:s=e.dateTime({width:"full"});break}return s.replace("{{date}}",S(n,e)).replace("{{time}}",ie(a,e))},Q={p:ie,P:rt},at=/^D+$/,st=/^Y+$/,ot=["D","DD","YY","YYYY"];function ue(r){return at.test(r)}function ce(r){return st.test(r)}function R(r,e,t){const n=it(r,e,t);if(console.warn(n),ot.includes(r))throw new RangeError(n)}function it(r,e,t){const n=r[0]==="Y"?"years":"days of the month";return`Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const ut=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,ct=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,dt=/^'([^]*?)'?$/,lt=/''/g,ft=/[a-zA-Z]/;function ee(r,e,t){const n=_(),a=n.locale??ae,s=n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,o=n.weekStartsOn??n.locale?.options?.weekStartsOn??0,d=p(r);if(!re(d))throw new RangeError("Invalid time value");let M=e.match(ct).map(b=>{const f=b[0];if(f==="p"||f==="P"){const N=Q[f];return N(b,a.formatLong)}return b}).join("").match(ut).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const f=b[0];if(f==="'")return{isToken:!1,value:ht(b)};if(Z[f])return{isToken:!0,value:b};if(f.match(ft))throw new RangeError("Format string contains an unescaped latin alphabet character `"+f+"`");return{isToken:!1,value:b}});a.localize.preprocessor&&(M=a.localize.preprocessor(d,M));const x={firstWeekContainsDate:s,weekStartsOn:o,locale:a};return M.map(b=>{if(!b.isToken)return b.value;const f=b.value;(ce(f)||ue(f))&&R(f,e,String(r));const N=Z[f[0]];return N(d,f,a.localize,x)}).join("")}function ht(r){const e=r.match(dt);return e?e[1].replace(lt,"'"):r}function mt(){return Object.assign({},_())}function wt(r){let t=p(r).getDay();return t===0&&(t=7),t}function yt(r,e){const t=e instanceof Date?m(e,0):new e(0);return t.setFullYear(r.getFullYear(),r.getMonth(),r.getDate()),t.setHours(r.getHours(),r.getMinutes(),r.getSeconds(),r.getMilliseconds()),t}const gt=10;class de{subPriority=0;validate(e,t){return!0}}class bt extends de{constructor(e,t,n,a,s){super(),this.value=e,this.validateValue=t,this.setValue=n,this.priority=a,s&&(this.subPriority=s)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,n){return this.setValue(e,t,this.value,n)}}class pt extends de{priority=gt;subPriority=-1;set(e,t){return t.timestampIsSet?e:m(e,yt(e,Date))}}class u{run(e,t,n,a){const s=this.parse(e,t,n,a);return s?{setter:new bt(s.value,this.validate,this.set,this.priority,this.subPriority),rest:s.rest}:null}validate(e,t,n){return!0}}class xt extends u{priority=140;parse(e,t,n){switch(t){case"G":case"GG":case"GGG":return n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"});case"GGGGG":return n.era(e,{width:"narrow"});case"GGGG":default:return n.era(e,{width:"wide"})||n.era(e,{width:"abbreviated"})||n.era(e,{width:"narrow"})}}set(e,t,n){return t.era=n,e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]}const y={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},D={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function g(r,e){return r&&{value:e(r.value),rest:r.rest}}function l(r,e){const t=e.match(r);return t?{value:parseInt(t[0],10),rest:e.slice(t[0].length)}:null}function T(r,e){const t=e.match(r);if(!t)return null;if(t[0]==="Z")return{value:0,rest:e.slice(1)};const n=t[1]==="+"?1:-1,a=t[2]?parseInt(t[2],10):0,s=t[3]?parseInt(t[3],10):0,o=t[5]?parseInt(t[5],10):0;return{value:n*(a*ye+s*we+o*ge),rest:e.slice(t[0].length)}}function le(r){return l(y.anyDigitsSigned,r)}function w(r,e){switch(r){case 1:return l(y.singleDigit,e);case 2:return l(y.twoDigits,e);case 3:return l(y.threeDigits,e);case 4:return l(y.fourDigits,e);default:return l(new RegExp("^\\d{1,"+r+"}"),e)}}function L(r,e){switch(r){case 1:return l(y.singleDigitSigned,e);case 2:return l(y.twoDigitsSigned,e);case 3:return l(y.threeDigitsSigned,e);case 4:return l(y.fourDigitsSigned,e);default:return l(new RegExp("^-?\\d{1,"+r+"}"),e)}}function B(r){switch(r){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function fe(r,e){const t=e>0,n=t?e:1-e;let a;if(n<=50)a=r||100;else{const s=n+50,o=Math.trunc(s/100)*100,d=r>=s%100;a=r+o-(d?100:0)}return t?a:1-a}function he(r){return r%400===0||r%4===0&&r%100!==0}class Mt extends u{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,n){const a=s=>({year:s,isTwoDigitYear:t==="yy"});switch(t){case"y":return g(w(4,e),a);case"yo":return g(n.ordinalNumber(e,{unit:"year"}),a);default:return g(w(t.length,e),a)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n){const a=e.getFullYear();if(n.isTwoDigitYear){const o=fe(n.year,a);return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}const s=!("era"in t)||t.era===1?n.year:1-n.year;return e.setFullYear(s,0,1),e.setHours(0,0,0,0),e}}class Pt extends u{priority=130;parse(e,t,n){const a=s=>({year:s,isTwoDigitYear:t==="YY"});switch(t){case"Y":return g(w(4,e),a);case"Yo":return g(n.ordinalNumber(e,{unit:"year"}),a);default:return g(w(t.length,e),a)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,n,a){const s=G(e,a);if(n.isTwoDigitYear){const d=fe(n.year,s);return e.setFullYear(d,0,a.firstWeekContainsDate),e.setHours(0,0,0,0),O(e,a)}const o=!("era"in t)||t.era===1?n.year:1-n.year;return e.setFullYear(o,0,a.firstWeekContainsDate),e.setHours(0,0,0,0),O(e,a)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class Dt extends u{priority=130;parse(e,t){return L(t==="R"?4:t.length,e)}set(e,t,n){const a=m(e,0);return a.setFullYear(n,0,4),a.setHours(0,0,0,0),W(a)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class Tt extends u{priority=130;parse(e,t){return L(t==="u"?4:t.length,e)}set(e,t,n){return e.setFullYear(n,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class kt extends u{priority=120;parse(e,t,n){switch(t){case"Q":case"QQ":return w(t.length,e);case"Qo":return n.ordinalNumber(e,{unit:"quarter"});case"QQQ":return n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return n.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(e,{width:"wide",context:"formatting"})||n.quarter(e,{width:"abbreviated",context:"formatting"})||n.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class Ot extends u{priority=120;parse(e,t,n){switch(t){case"q":case"qq":return w(t.length,e);case"qo":return n.ordinalNumber(e,{unit:"quarter"});case"qqq":return n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return n.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(e,{width:"wide",context:"standalone"})||n.quarter(e,{width:"abbreviated",context:"standalone"})||n.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,n){return e.setMonth((n-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class Yt extends u{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,n){const a=s=>s-1;switch(t){case"M":return g(l(y.month,e),a);case"MM":return g(w(2,e),a);case"Mo":return g(n.ordinalNumber(e,{unit:"month"}),a);case"MMM":return n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return n.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(e,{width:"wide",context:"formatting"})||n.month(e,{width:"abbreviated",context:"formatting"})||n.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}}class vt extends u{priority=110;parse(e,t,n){const a=s=>s-1;switch(t){case"L":return g(l(y.month,e),a);case"LL":return g(w(2,e),a);case"Lo":return g(n.ordinalNumber(e,{unit:"month"}),a);case"LLL":return n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return n.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(e,{width:"wide",context:"standalone"})||n.month(e,{width:"abbreviated",context:"standalone"})||n.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.setMonth(n,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function Et(r,e,t){const n=p(r),a=oe(n,t)-e;return n.setDate(n.getDate()-a*7),n}class Wt extends u{priority=100;parse(e,t,n){switch(t){case"w":return l(y.week,e);case"wo":return n.ordinalNumber(e,{unit:"week"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n,a){return O(Et(e,n,a),a)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function _t(r,e){const t=p(r),n=se(t)-e;return t.setDate(t.getDate()-n*7),t}class Nt extends u{priority=100;parse(e,t,n){switch(t){case"I":return l(y.week,e);case"Io":return n.ordinalNumber(e,{unit:"week"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,n){return W(_t(e,n))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const qt=[31,28,31,30,31,30,31,31,30,31,30,31],Ht=[31,29,31,30,31,30,31,31,30,31,30,31];class Ft extends u{priority=90;subPriority=1;parse(e,t,n){switch(t){case"d":return l(y.date,e);case"do":return n.ordinalNumber(e,{unit:"date"});default:return w(t.length,e)}}validate(e,t){const n=e.getFullYear(),a=he(n),s=e.getMonth();return a?t>=1&&t<=Ht[s]:t>=1&&t<=qt[s]}set(e,t,n){return e.setDate(n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class Lt extends u{priority=90;subpriority=1;parse(e,t,n){switch(t){case"D":case"DD":return l(y.dayOfYear,e);case"Do":return n.ordinalNumber(e,{unit:"date"});default:return w(t.length,e)}}validate(e,t){const n=e.getFullYear();return he(n)?t>=1&&t<=366:t>=1&&t<=365}set(e,t,n){return e.setMonth(0,n),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function A(r,e,t){const n=_(),a=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=p(r),o=s.getDay(),M=(e%7+7)%7,x=7-a,b=e<0||e>6?e-(o+x)%7:(M+x)%7-(o+x)%7;return X(s,b)}class Ct extends u{priority=90;parse(e,t,n){switch(t){case"E":case"EE":case"EEE":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return n.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=A(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]}class It extends u{priority=90;parse(e,t,n,a){const s=o=>{const d=Math.floor((o-1)/7)*7;return(o+a.weekStartsOn+6)%7+d};switch(t){case"e":case"ee":return g(w(t.length,e),s);case"eo":return g(n.ordinalNumber(e,{unit:"day"}),s);case"eee":return n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeeee":return n.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=A(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class Qt extends u{priority=90;parse(e,t,n,a){const s=o=>{const d=Math.floor((o-1)/7)*7;return(o+a.weekStartsOn+6)%7+d};switch(t){case"c":case"cc":return g(w(t.length,e),s);case"co":return g(n.ordinalNumber(e,{unit:"day"}),s);case"ccc":return n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"ccccc":return n.day(e,{width:"narrow",context:"standalone"});case"cccccc":return n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return n.day(e,{width:"wide",context:"standalone"})||n.day(e,{width:"abbreviated",context:"standalone"})||n.day(e,{width:"short",context:"standalone"})||n.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,n,a){return e=A(e,n,a),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function Rt(r,e){const t=p(r),n=wt(t),a=e-n;return X(t,a)}class Xt extends u{priority=90;parse(e,t,n){const a=s=>s===0?7:s;switch(t){case"i":case"ii":return w(t.length,e);case"io":return n.ordinalNumber(e,{unit:"day"});case"iii":return g(n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiii":return g(n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiiii":return g(n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiii":default:return g(n.day(e,{width:"wide",context:"formatting"})||n.day(e,{width:"abbreviated",context:"formatting"})||n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a)}}validate(e,t){return t>=1&&t<=7}set(e,t,n){return e=Rt(e,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class Gt extends u{priority=80;parse(e,t,n){switch(t){case"a":case"aa":case"aaa":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(B(n),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]}class Bt extends u{priority=80;parse(e,t,n){switch(t){case"b":case"bb":case"bbb":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(B(n),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]}class At extends u{priority=80;parse(e,t,n){switch(t){case"B":case"BB":case"BBB":return n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return n.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(e,{width:"wide",context:"formatting"})||n.dayPeriod(e,{width:"abbreviated",context:"formatting"})||n.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,n){return e.setHours(B(n),0,0,0),e}incompatibleTokens=["a","b","t","T"]}class $t extends u{priority=70;parse(e,t,n){switch(t){case"h":return l(y.hour12h,e);case"ho":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,n){const a=e.getHours()>=12;return a&&n<12?e.setHours(n+12,0,0,0):!a&&n===12?e.setHours(0,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]}class jt extends u{priority=70;parse(e,t,n){switch(t){case"H":return l(y.hour23h,e);case"Ho":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,n){return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]}class Vt extends u{priority=70;parse(e,t,n){switch(t){case"K":return l(y.hour11h,e);case"Ko":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,n){return e.getHours()>=12&&n<12?e.setHours(n+12,0,0,0):e.setHours(n,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]}class zt extends u{priority=70;parse(e,t,n){switch(t){case"k":return l(y.hour24h,e);case"ko":return n.ordinalNumber(e,{unit:"hour"});default:return w(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,n){const a=n<=24?n%24:n;return e.setHours(a,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]}class Jt extends u{priority=60;parse(e,t,n){switch(t){case"m":return l(y.minute,e);case"mo":return n.ordinalNumber(e,{unit:"minute"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setMinutes(n,0,0),e}incompatibleTokens=["t","T"]}class Zt extends u{priority=50;parse(e,t,n){switch(t){case"s":return l(y.second,e);case"so":return n.ordinalNumber(e,{unit:"second"});default:return w(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,n){return e.setSeconds(n,0),e}incompatibleTokens=["t","T"]}class Kt extends u{priority=30;parse(e,t){const n=a=>Math.trunc(a*Math.pow(10,-t.length+3));return g(w(t.length,e),n)}set(e,t,n){return e.setMilliseconds(n),e}incompatibleTokens=["t","T"]}class Ut extends u{priority=10;parse(e,t){switch(t){case"X":return T(D.basicOptionalMinutes,e);case"XX":return T(D.basic,e);case"XXXX":return T(D.basicOptionalSeconds,e);case"XXXXX":return T(D.extendedOptionalSeconds,e);case"XXX":default:return T(D.extended,e)}}set(e,t,n){return t.timestampIsSet?e:m(e,e.getTime()-F(e)-n)}incompatibleTokens=["t","T","x"]}class St extends u{priority=10;parse(e,t){switch(t){case"x":return T(D.basicOptionalMinutes,e);case"xx":return T(D.basic,e);case"xxxx":return T(D.basicOptionalSeconds,e);case"xxxxx":return T(D.extendedOptionalSeconds,e);case"xxx":default:return T(D.extended,e)}}set(e,t,n){return t.timestampIsSet?e:m(e,e.getTime()-F(e)-n)}incompatibleTokens=["t","T","X"]}class en extends u{priority=40;parse(e){return le(e)}set(e,t,n){return[m(e,n*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"}class tn extends u{priority=20;parse(e){return le(e)}set(e,t,n){return[m(e,n),{timestampIsSet:!0}]}incompatibleTokens="*"}const nn={G:new xt,y:new Mt,Y:new Pt,R:new Dt,u:new Tt,Q:new kt,q:new Ot,M:new Yt,L:new vt,w:new Wt,I:new Nt,d:new Ft,D:new Lt,E:new Ct,e:new It,c:new Qt,i:new Xt,a:new Gt,b:new Bt,B:new At,h:new $t,H:new jt,K:new Vt,k:new zt,m:new Jt,s:new Zt,S:new Kt,X:new Ut,x:new St,t:new en,T:new tn},rn=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,an=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sn=/^'([^]*?)'?$/,on=/''/g,un=/\S/,cn=/[a-zA-Z]/;function dn(r,e,t,n){const a=mt(),s=a.locale??ae,o=a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,d=a.weekStartsOn??a.locale?.options?.weekStartsOn??0;if(e==="")return r===""?p(t):m(t,NaN);const M={firstWeekContainsDate:o,weekStartsOn:d,locale:s},x=[new pt],b=e.match(an).map(i=>{const h=i[0];if(h in Q){const P=Q[h];return P(i,s.formatLong)}return i}).join("").match(rn),f=[];for(let i of b){ce(i)&&R(i,e,r),ue(i)&&R(i,e,r);const h=i[0],P=nn[h];if(P){const{incompatibleTokens:j}=P;if(Array.isArray(j)){const V=f.find(z=>j.includes(z.token)||z.token===h);if(V)throw new RangeError(`The format string mustn't contain \`${V.fullToken}\` and \`${i}\` at the same time`)}else if(P.incompatibleTokens==="*"&&f.length>0)throw new RangeError(`The format string mustn't contain \`${i}\` and any other token at the same time`);f.push({token:h,fullToken:i});const C=P.run(r,i,s.match,M);if(!C)return m(t,NaN);x.push(C.setter),r=C.rest}else{if(h.match(cn))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");if(i==="''"?i="'":h==="'"&&(i=ln(i)),r.indexOf(i)===0)r=r.slice(i.length);else return m(t,NaN)}}if(r.length>0&&un.test(r))return m(t,NaN);const N=x.map(i=>i.priority).sort((i,h)=>h-i).filter((i,h,P)=>P.indexOf(i)===h).map(i=>x.filter(h=>h.priority===i).sort((h,P)=>P.subPriority-h.subPriority)).map(i=>i[0]);let v=p(t);if(isNaN(v.getTime()))return m(t,NaN);const $={};for(const i of N){if(!i.validate(v,M))return m(t,NaN);const h=i.set(v,$,M);Array.isArray(h)?(v=h[0],Object.assign($,h[1])):v=h}return m(t,v)}function ln(r){return r.match(sn)[1].replace(on,"'")}function fn(r,e){return X(r,-e)}function hn(r,e=!1){const t=r.getDate(),n=r.getMonth()+1,a=r.getFullYear();return e?`${("0"+t).slice(-2)}-${("0"+n).slice(-2)}-${a}`:`${a}-${("0"+n).slice(-2)}-${("0"+t).slice(-2)}`}const mn=r=>{if(typeof r=="string"){const e=new Date(r);return isNaN(e.valueOf())?"":ee(e,"dd/MM/yyyy")}return ee(r,"dd/MM/yyyy")},wn=(r=new Date,e)=>(e<0&&(e=0),fn(r,e));function yn(r){const t=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy"].map(n=>dn(r,n,new Date)).find(n=>re(n));if(t){const n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0),a=new Date(t.getFullYear(),t.getMonth(),t.getDate(),23,59,59);return{start:n.toISOString(),end:a.toISOString()}}return{start:null,end:null}}exports.formatDate=hn;exports.formatDateToddMMYYYY=mn;exports.getStartAndEndOfDayUTC=yn;exports.subtractDaysFromDate=wn;
|
package/dist/DateUtils.js
CHANGED
|
@@ -5,7 +5,7 @@ function p(r) {
|
|
|
5
5
|
function m(r, e) {
|
|
6
6
|
return r instanceof Date ? new r.constructor(e) : new Date(e);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function X(r, e) {
|
|
9
9
|
const t = p(r);
|
|
10
10
|
return isNaN(e) ? m(r, NaN) : (e && t.setDate(t.getDate() + e), t);
|
|
11
11
|
}
|
|
@@ -135,7 +135,7 @@ const De = {
|
|
|
135
135
|
const a = De[r];
|
|
136
136
|
return typeof a == "string" ? n = a : e === 1 ? n = a.one : n = a.other.replace("{{count}}", e.toString()), t?.addSuffix ? t.comparison && t.comparison > 0 ? "in " + n : n + " ago" : n;
|
|
137
137
|
};
|
|
138
|
-
function
|
|
138
|
+
function I(r) {
|
|
139
139
|
return (e = {}) => {
|
|
140
140
|
const t = e.width ? String(e.width) : r.defaultWidth;
|
|
141
141
|
return r.formats[t] || r.formats[r.defaultWidth];
|
|
@@ -157,15 +157,15 @@ const ke = {
|
|
|
157
157
|
medium: "{{date}}, {{time}}",
|
|
158
158
|
short: "{{date}}, {{time}}"
|
|
159
159
|
}, ve = {
|
|
160
|
-
date:
|
|
160
|
+
date: I({
|
|
161
161
|
formats: ke,
|
|
162
162
|
defaultWidth: "full"
|
|
163
163
|
}),
|
|
164
|
-
time:
|
|
164
|
+
time: I({
|
|
165
165
|
formats: Oe,
|
|
166
166
|
defaultWidth: "full"
|
|
167
167
|
}),
|
|
168
|
-
dateTime:
|
|
168
|
+
dateTime: I({
|
|
169
169
|
formats: Ye,
|
|
170
170
|
defaultWidth: "full"
|
|
171
171
|
})
|
|
@@ -395,11 +395,11 @@ const Ge = /^(\d+)(th|st|nd|rd)?/i, Be = /\d+/i, Ae = {
|
|
|
395
395
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
396
396
|
}, Ve = {
|
|
397
397
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
398
|
-
},
|
|
398
|
+
}, ze = {
|
|
399
399
|
narrow: /^[jfmasond]/i,
|
|
400
400
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
401
401
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
402
|
-
},
|
|
402
|
+
}, Je = {
|
|
403
403
|
narrow: [
|
|
404
404
|
/^j/i,
|
|
405
405
|
/^f/i,
|
|
@@ -428,7 +428,7 @@ const Ge = /^(\d+)(th|st|nd|rd)?/i, Be = /\d+/i, Ae = {
|
|
|
428
428
|
/^n/i,
|
|
429
429
|
/^d/i
|
|
430
430
|
]
|
|
431
|
-
},
|
|
431
|
+
}, Ze = {
|
|
432
432
|
narrow: /^[smtwf]/i,
|
|
433
433
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
434
434
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
@@ -470,13 +470,13 @@ const Ge = /^(\d+)(th|st|nd|rd)?/i, Be = /\d+/i, Ae = {
|
|
|
470
470
|
valueCallback: (r) => r + 1
|
|
471
471
|
}),
|
|
472
472
|
month: H({
|
|
473
|
-
matchPatterns:
|
|
473
|
+
matchPatterns: ze,
|
|
474
474
|
defaultMatchWidth: "wide",
|
|
475
|
-
parsePatterns:
|
|
475
|
+
parsePatterns: Je,
|
|
476
476
|
defaultParseWidth: "any"
|
|
477
477
|
}),
|
|
478
478
|
day: H({
|
|
479
|
-
matchPatterns:
|
|
479
|
+
matchPatterns: Ze,
|
|
480
480
|
defaultMatchWidth: "wide",
|
|
481
481
|
parsePatterns: Ke,
|
|
482
482
|
defaultParseWidth: "any"
|
|
@@ -507,7 +507,7 @@ function se(r) {
|
|
|
507
507
|
const e = p(r), t = +W(e) - +xe(e);
|
|
508
508
|
return Math.round(t / te) + 1;
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function G(r, e) {
|
|
511
511
|
const t = p(r), n = t.getFullYear(), a = _(), s = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? a.firstWeekContainsDate ?? a.locale?.options?.firstWeekContainsDate ?? 1, o = m(r, 0);
|
|
512
512
|
o.setFullYear(n + 1, 0, s), o.setHours(0, 0, 0, 0);
|
|
513
513
|
const d = O(o, e), M = m(r, 0);
|
|
@@ -516,7 +516,7 @@ function B(r, e) {
|
|
|
516
516
|
return t.getTime() >= d.getTime() ? n + 1 : t.getTime() >= x.getTime() ? n : n - 1;
|
|
517
517
|
}
|
|
518
518
|
function nt(r, e) {
|
|
519
|
-
const t = _(), n = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? t.firstWeekContainsDate ?? t.locale?.options?.firstWeekContainsDate ?? 1, a =
|
|
519
|
+
const t = _(), n = e?.firstWeekContainsDate ?? e?.locale?.options?.firstWeekContainsDate ?? t.firstWeekContainsDate ?? t.locale?.options?.firstWeekContainsDate ?? 1, a = G(r, e), s = m(r, 0);
|
|
520
520
|
return s.setFullYear(a, 0, n), s.setHours(0, 0, 0, 0), O(s, e);
|
|
521
521
|
}
|
|
522
522
|
function oe(r, e) {
|
|
@@ -590,7 +590,7 @@ const k = {
|
|
|
590
590
|
afternoon: "afternoon",
|
|
591
591
|
evening: "evening",
|
|
592
592
|
night: "night"
|
|
593
|
-
},
|
|
593
|
+
}, Z = {
|
|
594
594
|
// Era
|
|
595
595
|
G: function(r, e, t) {
|
|
596
596
|
const n = r.getFullYear() > 0 ? 1 : 0;
|
|
@@ -616,7 +616,7 @@ const k = {
|
|
|
616
616
|
},
|
|
617
617
|
// Local week-numbering year
|
|
618
618
|
Y: function(r, e, t, n) {
|
|
619
|
-
const a =
|
|
619
|
+
const a = G(r, n), s = a > 0 ? a : 1 - a;
|
|
620
620
|
if (e === "YY") {
|
|
621
621
|
const o = s % 100;
|
|
622
622
|
return c(o, 2);
|
|
@@ -1016,7 +1016,7 @@ const k = {
|
|
|
1016
1016
|
return "Z";
|
|
1017
1017
|
switch (e) {
|
|
1018
1018
|
case "X":
|
|
1019
|
-
return
|
|
1019
|
+
return U(n);
|
|
1020
1020
|
case "XXXX":
|
|
1021
1021
|
case "XX":
|
|
1022
1022
|
return Y(n);
|
|
@@ -1031,7 +1031,7 @@ const k = {
|
|
|
1031
1031
|
const n = r.getTimezoneOffset();
|
|
1032
1032
|
switch (e) {
|
|
1033
1033
|
case "x":
|
|
1034
|
-
return
|
|
1034
|
+
return U(n);
|
|
1035
1035
|
case "xxxx":
|
|
1036
1036
|
case "xx":
|
|
1037
1037
|
return Y(n);
|
|
@@ -1048,7 +1048,7 @@ const k = {
|
|
|
1048
1048
|
case "O":
|
|
1049
1049
|
case "OO":
|
|
1050
1050
|
case "OOO":
|
|
1051
|
-
return "GMT" +
|
|
1051
|
+
return "GMT" + K(n, ":");
|
|
1052
1052
|
case "OOOO":
|
|
1053
1053
|
default:
|
|
1054
1054
|
return "GMT" + Y(n, ":");
|
|
@@ -1061,7 +1061,7 @@ const k = {
|
|
|
1061
1061
|
case "z":
|
|
1062
1062
|
case "zz":
|
|
1063
1063
|
case "zzz":
|
|
1064
|
-
return "GMT" +
|
|
1064
|
+
return "GMT" + K(n, ":");
|
|
1065
1065
|
case "zzzz":
|
|
1066
1066
|
default:
|
|
1067
1067
|
return "GMT" + Y(n, ":");
|
|
@@ -1078,18 +1078,18 @@ const k = {
|
|
|
1078
1078
|
return c(n, e.length);
|
|
1079
1079
|
}
|
|
1080
1080
|
};
|
|
1081
|
-
function
|
|
1081
|
+
function K(r, e = "") {
|
|
1082
1082
|
const t = r > 0 ? "-" : "+", n = Math.abs(r), a = Math.trunc(n / 60), s = n % 60;
|
|
1083
1083
|
return s === 0 ? t + String(a) : t + String(a) + e + c(s, 2);
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function U(r, e) {
|
|
1086
1086
|
return r % 60 === 0 ? (r > 0 ? "-" : "+") + c(Math.abs(r) / 60, 2) : Y(r, e);
|
|
1087
1087
|
}
|
|
1088
1088
|
function Y(r, e = "") {
|
|
1089
1089
|
const t = r > 0 ? "-" : "+", n = Math.abs(r), a = c(Math.trunc(n / 60), 2), s = c(n % 60, 2);
|
|
1090
1090
|
return t + a + e + s;
|
|
1091
1091
|
}
|
|
1092
|
-
const
|
|
1092
|
+
const S = (r, e) => {
|
|
1093
1093
|
switch (r) {
|
|
1094
1094
|
case "P":
|
|
1095
1095
|
return e.date({ width: "short" });
|
|
@@ -1116,7 +1116,7 @@ const ee = (r, e) => {
|
|
|
1116
1116
|
}, rt = (r, e) => {
|
|
1117
1117
|
const t = r.match(/(P+)(p+)?/) || [], n = t[1], a = t[2];
|
|
1118
1118
|
if (!a)
|
|
1119
|
-
return
|
|
1119
|
+
return S(r, e);
|
|
1120
1120
|
let s;
|
|
1121
1121
|
switch (n) {
|
|
1122
1122
|
case "P":
|
|
@@ -1133,8 +1133,8 @@ const ee = (r, e) => {
|
|
|
1133
1133
|
s = e.dateTime({ width: "full" });
|
|
1134
1134
|
break;
|
|
1135
1135
|
}
|
|
1136
|
-
return s.replace("{{date}}",
|
|
1137
|
-
},
|
|
1136
|
+
return s.replace("{{date}}", S(n, e)).replace("{{time}}", ie(a, e));
|
|
1137
|
+
}, Q = {
|
|
1138
1138
|
p: ie,
|
|
1139
1139
|
P: rt
|
|
1140
1140
|
}, at = /^D+$/, st = /^Y+$/, ot = ["D", "DD", "YY", "YYYY"];
|
|
@@ -1144,7 +1144,7 @@ function ue(r) {
|
|
|
1144
1144
|
function ce(r) {
|
|
1145
1145
|
return st.test(r);
|
|
1146
1146
|
}
|
|
1147
|
-
function
|
|
1147
|
+
function R(r, e, t) {
|
|
1148
1148
|
const n = it(r, e, t);
|
|
1149
1149
|
if (console.warn(n), ot.includes(r)) throw new RangeError(n);
|
|
1150
1150
|
}
|
|
@@ -1153,14 +1153,14 @@ function it(r, e, t) {
|
|
|
1153
1153
|
return `Use \`${r.toLowerCase()}\` instead of \`${r}\` (in \`${e}\`) for formatting ${n} to the input \`${t}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1154
1154
|
}
|
|
1155
1155
|
const ut = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, ct = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, dt = /^'([^]*?)'?$/, lt = /''/g, ft = /[a-zA-Z]/;
|
|
1156
|
-
function
|
|
1156
|
+
function ee(r, e, t) {
|
|
1157
1157
|
const n = _(), a = n.locale ?? ae, s = n.firstWeekContainsDate ?? n.locale?.options?.firstWeekContainsDate ?? 1, o = n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, d = p(r);
|
|
1158
1158
|
if (!re(d))
|
|
1159
1159
|
throw new RangeError("Invalid time value");
|
|
1160
1160
|
let M = e.match(ct).map((b) => {
|
|
1161
1161
|
const f = b[0];
|
|
1162
1162
|
if (f === "p" || f === "P") {
|
|
1163
|
-
const N =
|
|
1163
|
+
const N = Q[f];
|
|
1164
1164
|
return N(b, a.formatLong);
|
|
1165
1165
|
}
|
|
1166
1166
|
return b;
|
|
@@ -1170,7 +1170,7 @@ function L(r, e, t) {
|
|
|
1170
1170
|
const f = b[0];
|
|
1171
1171
|
if (f === "'")
|
|
1172
1172
|
return { isToken: !1, value: ht(b) };
|
|
1173
|
-
if (
|
|
1173
|
+
if (Z[f])
|
|
1174
1174
|
return { isToken: !0, value: b };
|
|
1175
1175
|
if (f.match(ft))
|
|
1176
1176
|
throw new RangeError(
|
|
@@ -1187,8 +1187,8 @@ function L(r, e, t) {
|
|
|
1187
1187
|
return M.map((b) => {
|
|
1188
1188
|
if (!b.isToken) return b.value;
|
|
1189
1189
|
const f = b.value;
|
|
1190
|
-
(ce(f) || ue(f)) &&
|
|
1191
|
-
const N =
|
|
1190
|
+
(ce(f) || ue(f)) && R(f, e, String(r));
|
|
1191
|
+
const N = Z[f[0]];
|
|
1192
1192
|
return N(d, f, a.localize, x);
|
|
1193
1193
|
}).join("");
|
|
1194
1194
|
}
|
|
@@ -1369,7 +1369,7 @@ function w(r, e) {
|
|
|
1369
1369
|
return l(new RegExp("^\\d{1," + r + "}"), e);
|
|
1370
1370
|
}
|
|
1371
1371
|
}
|
|
1372
|
-
function
|
|
1372
|
+
function L(r, e) {
|
|
1373
1373
|
switch (r) {
|
|
1374
1374
|
case 1:
|
|
1375
1375
|
return l(y.singleDigitSigned, e);
|
|
@@ -1383,7 +1383,7 @@ function C(r, e) {
|
|
|
1383
1383
|
return l(new RegExp("^-?\\d{1," + r + "}"), e);
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
function
|
|
1386
|
+
function B(r) {
|
|
1387
1387
|
switch (r) {
|
|
1388
1388
|
case "morning":
|
|
1389
1389
|
return 4;
|
|
@@ -1477,7 +1477,7 @@ class Pt extends u {
|
|
|
1477
1477
|
return t.isTwoDigitYear || t.year > 0;
|
|
1478
1478
|
}
|
|
1479
1479
|
set(e, t, n, a) {
|
|
1480
|
-
const s =
|
|
1480
|
+
const s = G(e, a);
|
|
1481
1481
|
if (n.isTwoDigitYear) {
|
|
1482
1482
|
const d = fe(
|
|
1483
1483
|
n.year,
|
|
@@ -1511,7 +1511,7 @@ class Pt extends u {
|
|
|
1511
1511
|
class Dt extends u {
|
|
1512
1512
|
priority = 130;
|
|
1513
1513
|
parse(e, t) {
|
|
1514
|
-
return
|
|
1514
|
+
return L(t === "R" ? 4 : t.length, e);
|
|
1515
1515
|
}
|
|
1516
1516
|
set(e, t, n) {
|
|
1517
1517
|
const a = m(e, 0);
|
|
@@ -1538,7 +1538,7 @@ class Dt extends u {
|
|
|
1538
1538
|
class Tt extends u {
|
|
1539
1539
|
priority = 130;
|
|
1540
1540
|
parse(e, t) {
|
|
1541
|
-
return
|
|
1541
|
+
return L(t === "u" ? 4 : t.length, e);
|
|
1542
1542
|
}
|
|
1543
1543
|
set(e, t, n) {
|
|
1544
1544
|
return e.setFullYear(n, 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
@@ -1946,9 +1946,9 @@ class Lt extends u {
|
|
|
1946
1946
|
"T"
|
|
1947
1947
|
];
|
|
1948
1948
|
}
|
|
1949
|
-
function
|
|
1949
|
+
function A(r, e, t) {
|
|
1950
1950
|
const n = _(), a = t?.weekStartsOn ?? t?.locale?.options?.weekStartsOn ?? n.weekStartsOn ?? n.locale?.options?.weekStartsOn ?? 0, s = p(r), o = s.getDay(), M = (e % 7 + 7) % 7, x = 7 - a, b = e < 0 || e > 6 ? e - (o + x) % 7 : (M + x) % 7 - (o + x) % 7;
|
|
1951
|
-
return
|
|
1951
|
+
return X(s, b);
|
|
1952
1952
|
}
|
|
1953
1953
|
class Ct extends u {
|
|
1954
1954
|
priority = 90;
|
|
@@ -1980,7 +1980,7 @@ class Ct extends u {
|
|
|
1980
1980
|
return t >= 0 && t <= 6;
|
|
1981
1981
|
}
|
|
1982
1982
|
set(e, t, n, a) {
|
|
1983
|
-
return e =
|
|
1983
|
+
return e = A(e, n, a), e.setHours(0, 0, 0, 0), e;
|
|
1984
1984
|
}
|
|
1985
1985
|
incompatibleTokens = ["D", "i", "e", "c", "t", "T"];
|
|
1986
1986
|
}
|
|
@@ -2026,7 +2026,7 @@ class It extends u {
|
|
|
2026
2026
|
return t >= 0 && t <= 6;
|
|
2027
2027
|
}
|
|
2028
2028
|
set(e, t, n, a) {
|
|
2029
|
-
return e =
|
|
2029
|
+
return e = A(e, n, a), e.setHours(0, 0, 0, 0), e;
|
|
2030
2030
|
}
|
|
2031
2031
|
incompatibleTokens = [
|
|
2032
2032
|
"y",
|
|
@@ -2088,7 +2088,7 @@ class Qt extends u {
|
|
|
2088
2088
|
return t >= 0 && t <= 6;
|
|
2089
2089
|
}
|
|
2090
2090
|
set(e, t, n, a) {
|
|
2091
|
-
return e =
|
|
2091
|
+
return e = A(e, n, a), e.setHours(0, 0, 0, 0), e;
|
|
2092
2092
|
}
|
|
2093
2093
|
incompatibleTokens = [
|
|
2094
2094
|
"y",
|
|
@@ -2110,7 +2110,7 @@ class Qt extends u {
|
|
|
2110
2110
|
}
|
|
2111
2111
|
function Rt(r, e) {
|
|
2112
2112
|
const t = p(r), n = wt(t), a = e - n;
|
|
2113
|
-
return
|
|
2113
|
+
return X(t, a);
|
|
2114
2114
|
}
|
|
2115
2115
|
class Xt extends u {
|
|
2116
2116
|
priority = 90;
|
|
@@ -2233,7 +2233,7 @@ class Gt extends u {
|
|
|
2233
2233
|
}
|
|
2234
2234
|
}
|
|
2235
2235
|
set(e, t, n) {
|
|
2236
|
-
return e.setHours(
|
|
2236
|
+
return e.setHours(B(n), 0, 0, 0), e;
|
|
2237
2237
|
}
|
|
2238
2238
|
incompatibleTokens = ["b", "B", "H", "k", "t", "T"];
|
|
2239
2239
|
}
|
|
@@ -2271,7 +2271,7 @@ class Bt extends u {
|
|
|
2271
2271
|
}
|
|
2272
2272
|
}
|
|
2273
2273
|
set(e, t, n) {
|
|
2274
|
-
return e.setHours(
|
|
2274
|
+
return e.setHours(B(n), 0, 0, 0), e;
|
|
2275
2275
|
}
|
|
2276
2276
|
incompatibleTokens = ["a", "B", "H", "k", "t", "T"];
|
|
2277
2277
|
}
|
|
@@ -2309,7 +2309,7 @@ class At extends u {
|
|
|
2309
2309
|
}
|
|
2310
2310
|
}
|
|
2311
2311
|
set(e, t, n) {
|
|
2312
|
-
return e.setHours(
|
|
2312
|
+
return e.setHours(B(n), 0, 0, 0), e;
|
|
2313
2313
|
}
|
|
2314
2314
|
incompatibleTokens = ["a", "b", "t", "T"];
|
|
2315
2315
|
}
|
|
@@ -2374,7 +2374,7 @@ class Vt extends u {
|
|
|
2374
2374
|
}
|
|
2375
2375
|
incompatibleTokens = ["h", "H", "k", "t", "T"];
|
|
2376
2376
|
}
|
|
2377
|
-
class
|
|
2377
|
+
class zt extends u {
|
|
2378
2378
|
priority = 70;
|
|
2379
2379
|
parse(e, t, n) {
|
|
2380
2380
|
switch (t) {
|
|
@@ -2395,7 +2395,7 @@ class Zt extends u {
|
|
|
2395
2395
|
}
|
|
2396
2396
|
incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"];
|
|
2397
2397
|
}
|
|
2398
|
-
class
|
|
2398
|
+
class Jt extends u {
|
|
2399
2399
|
priority = 60;
|
|
2400
2400
|
parse(e, t, n) {
|
|
2401
2401
|
switch (t) {
|
|
@@ -2415,7 +2415,7 @@ class zt extends u {
|
|
|
2415
2415
|
}
|
|
2416
2416
|
incompatibleTokens = ["t", "T"];
|
|
2417
2417
|
}
|
|
2418
|
-
class
|
|
2418
|
+
class Zt extends u {
|
|
2419
2419
|
priority = 50;
|
|
2420
2420
|
parse(e, t, n) {
|
|
2421
2421
|
switch (t) {
|
|
@@ -2558,9 +2558,9 @@ const nn = {
|
|
|
2558
2558
|
h: new $t(),
|
|
2559
2559
|
H: new jt(),
|
|
2560
2560
|
K: new Vt(),
|
|
2561
|
-
k: new
|
|
2562
|
-
m: new
|
|
2563
|
-
s: new
|
|
2561
|
+
k: new zt(),
|
|
2562
|
+
m: new Jt(),
|
|
2563
|
+
s: new Zt(),
|
|
2564
2564
|
S: new Kt(),
|
|
2565
2565
|
X: new Ut(),
|
|
2566
2566
|
x: new St(),
|
|
@@ -2577,39 +2577,39 @@ function dn(r, e, t, n) {
|
|
|
2577
2577
|
locale: s
|
|
2578
2578
|
}, x = [new pt()], b = e.match(an).map((i) => {
|
|
2579
2579
|
const h = i[0];
|
|
2580
|
-
if (h in
|
|
2581
|
-
const P =
|
|
2580
|
+
if (h in Q) {
|
|
2581
|
+
const P = Q[h];
|
|
2582
2582
|
return P(i, s.formatLong);
|
|
2583
2583
|
}
|
|
2584
2584
|
return i;
|
|
2585
2585
|
}).join("").match(rn), f = [];
|
|
2586
2586
|
for (let i of b) {
|
|
2587
|
-
ce(i) &&
|
|
2587
|
+
ce(i) && R(i, e, r), ue(i) && R(i, e, r);
|
|
2588
2588
|
const h = i[0], P = nn[h];
|
|
2589
2589
|
if (P) {
|
|
2590
|
-
const { incompatibleTokens:
|
|
2591
|
-
if (Array.isArray(
|
|
2592
|
-
const
|
|
2593
|
-
(z) =>
|
|
2590
|
+
const { incompatibleTokens: j } = P;
|
|
2591
|
+
if (Array.isArray(j)) {
|
|
2592
|
+
const V = f.find(
|
|
2593
|
+
(z) => j.includes(z.token) || z.token === h
|
|
2594
2594
|
);
|
|
2595
|
-
if (
|
|
2595
|
+
if (V)
|
|
2596
2596
|
throw new RangeError(
|
|
2597
|
-
`The format string mustn't contain \`${
|
|
2597
|
+
`The format string mustn't contain \`${V.fullToken}\` and \`${i}\` at the same time`
|
|
2598
2598
|
);
|
|
2599
2599
|
} else if (P.incompatibleTokens === "*" && f.length > 0)
|
|
2600
2600
|
throw new RangeError(
|
|
2601
2601
|
`The format string mustn't contain \`${i}\` and any other token at the same time`
|
|
2602
2602
|
);
|
|
2603
2603
|
f.push({ token: h, fullToken: i });
|
|
2604
|
-
const
|
|
2604
|
+
const C = P.run(
|
|
2605
2605
|
r,
|
|
2606
2606
|
i,
|
|
2607
2607
|
s.match,
|
|
2608
2608
|
M
|
|
2609
2609
|
);
|
|
2610
|
-
if (!
|
|
2610
|
+
if (!C)
|
|
2611
2611
|
return m(t, NaN);
|
|
2612
|
-
x.push(
|
|
2612
|
+
x.push(C.setter), r = C.rest;
|
|
2613
2613
|
} else {
|
|
2614
2614
|
if (h.match(cn))
|
|
2615
2615
|
throw new RangeError(
|
|
@@ -2629,12 +2629,12 @@ function dn(r, e, t, n) {
|
|
|
2629
2629
|
let v = p(t);
|
|
2630
2630
|
if (isNaN(v.getTime()))
|
|
2631
2631
|
return m(t, NaN);
|
|
2632
|
-
const
|
|
2632
|
+
const $ = {};
|
|
2633
2633
|
for (const i of N) {
|
|
2634
2634
|
if (!i.validate(v, M))
|
|
2635
2635
|
return m(t, NaN);
|
|
2636
|
-
const h = i.set(v,
|
|
2637
|
-
Array.isArray(h) ? (v = h[0], Object.assign(
|
|
2636
|
+
const h = i.set(v, $, M);
|
|
2637
|
+
Array.isArray(h) ? (v = h[0], Object.assign($, h[1])) : v = h;
|
|
2638
2638
|
}
|
|
2639
2639
|
return m(t, v);
|
|
2640
2640
|
}
|
|
@@ -2642,7 +2642,7 @@ function ln(r) {
|
|
|
2642
2642
|
return r.match(sn)[1].replace(on, "'");
|
|
2643
2643
|
}
|
|
2644
2644
|
function fn(r, e) {
|
|
2645
|
-
return
|
|
2645
|
+
return X(r, -e);
|
|
2646
2646
|
}
|
|
2647
2647
|
function hn(r, e = !1) {
|
|
2648
2648
|
const t = r.getDate(), n = r.getMonth() + 1, a = r.getFullYear();
|
|
@@ -2651,18 +2651,18 @@ function hn(r, e = !1) {
|
|
|
2651
2651
|
const mn = (r) => {
|
|
2652
2652
|
if (typeof r == "string") {
|
|
2653
2653
|
const e = new Date(r);
|
|
2654
|
-
return isNaN(e.valueOf()) ? "" :
|
|
2654
|
+
return isNaN(e.valueOf()) ? "" : ee(e, "dd/MM/yyyy");
|
|
2655
2655
|
}
|
|
2656
|
-
return
|
|
2656
|
+
return ee(r, "dd/MM/yyyy");
|
|
2657
2657
|
}, wn = (r = /* @__PURE__ */ new Date(), e) => (e < 0 && (e = 0), fn(r, e));
|
|
2658
2658
|
function yn(r) {
|
|
2659
2659
|
const t = ["yyyy-MM-dd", "yyyy/MM/dd", "dd/MM/yyyy", "dd-MM-yyyy"].map((n) => dn(r, n, /* @__PURE__ */ new Date())).find((n) => re(n));
|
|
2660
2660
|
if (t) {
|
|
2661
|
-
const n = new Date(
|
|
2661
|
+
const n = new Date(t.getFullYear(), t.getMonth(), t.getDate(), 0, 0, 0), a = new Date(t.getFullYear(), t.getMonth(), t.getDate(), 23, 59, 59);
|
|
2662
2662
|
return {
|
|
2663
|
-
start:
|
|
2663
|
+
start: n.toISOString(),
|
|
2664
2664
|
// Format in ISO 8601
|
|
2665
|
-
end:
|
|
2665
|
+
end: a.toISOString()
|
|
2666
2666
|
};
|
|
2667
2667
|
}
|
|
2668
2668
|
return { start: null, end: null };
|