@wikicasa-dev/utilities 1.1.3 → 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 +141 -133
- package/dist/index.cjs +1 -1
- package/dist/index.js +28 -28
- package/dist/utils/DateUtils.d.ts +9 -18
- 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,be=1e3;let ge={};function _(){return ge}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 Z(r){const e=p(r);return e.setHours(0,0,0,0),e}function L(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=Z(r),n=Z(e),a=+t-L(t),s=+n-L(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"]},Le={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"}},Fe={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:Le,defaultWidth:"wide",formattingValues:Fe,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 g=e.slice(o.length);return{value:x,rest:g}}}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 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))},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 X(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(g=>{const f=g[0];if(f==="p"||f==="P"){const N=Q[f];return N(g,a.formatLong)}return g}).join("").match(ut).map(g=>{if(g==="''")return{isToken:!1,value:"'"};const f=g[0];if(f==="'")return{isToken:!1,value:ht(g)};if(K[f])return{isToken:!0,value:g};if(f.match(ft))throw new RangeError("Format string contains an unescaped latin alphabet character `"+f+"`");return{isToken:!1,value:g}});a.localize.preprocessor&&(M=a.localize.preprocessor(d,M));const x={firstWeekContainsDate:s,weekStartsOn:o,locale:a};return M.map(g=>{if(!g.isToken)return g.value;const f=g.value;(ce(f)||ue(f))&&R(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 bt=10;class de{subPriority=0;validate(e,t){return!0}}class gt 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=bt;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 gt(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 b(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*be),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 F(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 b(w(4,e),a);case"yo":return b(n.ordinalNumber(e,{unit:"year"}),a);default:return b(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 b(w(4,e),a);case"Yo":return b(n.ordinalNumber(e,{unit:"year"}),a);default:return b(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 Dt extends u{priority=130;parse(e,t){return F(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 F(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 b(l(y.month,e),a);case"MM":return b(w(2,e),a);case"Mo":return b(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 b(l(y.month,e),a);case"LL":return b(w(2,e),a);case"Lo":return b(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 Lt 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 Ft 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,g=e<0||e>6?e-(o+x)%7:(M+x)%7-(o+x)%7;return G(s,g)}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=$(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 b(w(t.length,e),s);case"eo":return b(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 b(w(t.length,e),s);case"co":return b(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 b(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 b(n.day(e,{width:"narrow",context:"formatting"}),a);case"iiiiii":return b(n.day(e,{width:"short",context:"formatting"})||n.day(e,{width:"narrow",context:"formatting"}),a);case"iiii":default:return b(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 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 b(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()-L(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()-L(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 Lt,D:new Ft,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],g=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 g){ce(i)&&R(i,e,r),ue(i)&&R(i,e,r);const h=i[0],P=nn[h];if(P){const{incompatibleTokens:V}=P;if(Array.isArray(V)){const z=f.find(J=>V.includes(J.token)||J.token===h);if(z)throw new RangeError(`The format string mustn't contain \`${z.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 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())?"":X(e,"dd/MM/yyyy")}return X(r,"dd/MM/yyyy")},wn=(r=new Date,e)=>(e<0&&(e=0),fn(r,e));function yn(r){const e=["yyyy-MM-dd","yyyy/MM/dd","dd/MM/yyyy","dd-MM-yyyy"].map(t=>dn(r,t,new Date)).find(t=>re(t));return e?X(e,"yyyy-MM-dd"):null}exports.formatDate=hn;exports.formatDateToddMMYYYY=mn;exports.normalizeDate=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,14 +5,14 @@ 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
|
}
|
|
12
|
-
const te = 6048e5, me = 864e5, we = 6e4, ye = 36e5,
|
|
13
|
-
let
|
|
12
|
+
const te = 6048e5, me = 864e5, we = 6e4, ye = 36e5, ge = 1e3;
|
|
13
|
+
let be = {};
|
|
14
14
|
function _() {
|
|
15
|
-
return
|
|
15
|
+
return be;
|
|
16
16
|
}
|
|
17
17
|
function O(r, e) {
|
|
18
18
|
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;
|
|
@@ -29,11 +29,11 @@ function ne(r) {
|
|
|
29
29
|
const o = W(s);
|
|
30
30
|
return e.getTime() >= a.getTime() ? t + 1 : e.getTime() >= o.getTime() ? t : t - 1;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function J(r) {
|
|
33
33
|
const e = p(r);
|
|
34
34
|
return e.setHours(0, 0, 0, 0), e;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function F(r) {
|
|
37
37
|
const e = p(r), t = new Date(
|
|
38
38
|
Date.UTC(
|
|
39
39
|
e.getFullYear(),
|
|
@@ -48,7 +48,7 @@ function L(r) {
|
|
|
48
48
|
return t.setUTCFullYear(e.getFullYear()), +r - +t;
|
|
49
49
|
}
|
|
50
50
|
function pe(r, e) {
|
|
51
|
-
const t =
|
|
51
|
+
const t = J(r), n = J(e), a = +t - F(t), s = +n - F(n);
|
|
52
52
|
return Math.round((a - s) / me);
|
|
53
53
|
}
|
|
54
54
|
function xe(r) {
|
|
@@ -68,7 +68,7 @@ function Pe(r) {
|
|
|
68
68
|
const e = p(r), t = m(r, 0);
|
|
69
69
|
return t.setFullYear(e.getFullYear(), 0, 1), t.setHours(0, 0, 0, 0), t;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const De = {
|
|
72
72
|
lessThanXSeconds: {
|
|
73
73
|
one: "less than a second",
|
|
74
74
|
other: "less than {{count}} seconds"
|
|
@@ -130,9 +130,9 @@ const Te = {
|
|
|
130
130
|
one: "almost 1 year",
|
|
131
131
|
other: "almost {{count}} years"
|
|
132
132
|
}
|
|
133
|
-
},
|
|
133
|
+
}, Te = (r, e, t) => {
|
|
134
134
|
let n;
|
|
135
|
-
const a =
|
|
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
138
|
function I(r) {
|
|
@@ -243,7 +243,7 @@ const _e = {
|
|
|
243
243
|
"Friday",
|
|
244
244
|
"Saturday"
|
|
245
245
|
]
|
|
246
|
-
},
|
|
246
|
+
}, Fe = {
|
|
247
247
|
narrow: {
|
|
248
248
|
am: "a",
|
|
249
249
|
pm: "p",
|
|
@@ -274,7 +274,7 @@ const _e = {
|
|
|
274
274
|
evening: "evening",
|
|
275
275
|
night: "night"
|
|
276
276
|
}
|
|
277
|
-
},
|
|
277
|
+
}, Le = {
|
|
278
278
|
narrow: {
|
|
279
279
|
am: "a",
|
|
280
280
|
pm: "p",
|
|
@@ -337,9 +337,9 @@ const _e = {
|
|
|
337
337
|
defaultWidth: "wide"
|
|
338
338
|
}),
|
|
339
339
|
dayPeriod: q({
|
|
340
|
-
values:
|
|
340
|
+
values: Fe,
|
|
341
341
|
defaultWidth: "wide",
|
|
342
|
-
formattingValues:
|
|
342
|
+
formattingValues: Le,
|
|
343
343
|
defaultFormattingWidth: "wide"
|
|
344
344
|
})
|
|
345
345
|
};
|
|
@@ -357,8 +357,8 @@ function H(r) {
|
|
|
357
357
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
358
358
|
t.valueCallback(x)
|
|
359
359
|
) : x;
|
|
360
|
-
const
|
|
361
|
-
return { value: x, rest:
|
|
360
|
+
const b = e.slice(o.length);
|
|
361
|
+
return { value: x, rest: b };
|
|
362
362
|
};
|
|
363
363
|
}
|
|
364
364
|
function Qe(r, e) {
|
|
@@ -489,7 +489,7 @@ const Ge = /^(\d+)(th|st|nd|rd)?/i, Be = /\d+/i, Ae = {
|
|
|
489
489
|
})
|
|
490
490
|
}, ae = {
|
|
491
491
|
code: "en-US",
|
|
492
|
-
formatDistance:
|
|
492
|
+
formatDistance: Te,
|
|
493
493
|
formatLong: ve,
|
|
494
494
|
formatRelative: We,
|
|
495
495
|
localize: Ie,
|
|
@@ -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,7 +1133,7 @@ const ee = (r, e) => {
|
|
|
1133
1133
|
s = e.dateTime({ width: "full" });
|
|
1134
1134
|
break;
|
|
1135
1135
|
}
|
|
1136
|
-
return s.replace("{{date}}",
|
|
1136
|
+
return s.replace("{{date}}", S(n, e)).replace("{{time}}", ie(a, e));
|
|
1137
1137
|
}, Q = {
|
|
1138
1138
|
p: ie,
|
|
1139
1139
|
P: rt
|
|
@@ -1153,30 +1153,30 @@ 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
|
-
let M = e.match(ct).map((
|
|
1161
|
-
const f =
|
|
1160
|
+
let M = e.match(ct).map((b) => {
|
|
1161
|
+
const f = b[0];
|
|
1162
1162
|
if (f === "p" || f === "P") {
|
|
1163
1163
|
const N = Q[f];
|
|
1164
|
-
return N(
|
|
1164
|
+
return N(b, a.formatLong);
|
|
1165
1165
|
}
|
|
1166
|
-
return
|
|
1167
|
-
}).join("").match(ut).map((
|
|
1168
|
-
if (
|
|
1166
|
+
return b;
|
|
1167
|
+
}).join("").match(ut).map((b) => {
|
|
1168
|
+
if (b === "''")
|
|
1169
1169
|
return { isToken: !1, value: "'" };
|
|
1170
|
-
const f =
|
|
1170
|
+
const f = b[0];
|
|
1171
1171
|
if (f === "'")
|
|
1172
|
-
return { isToken: !1, value: ht(
|
|
1173
|
-
if (
|
|
1174
|
-
return { isToken: !0, value:
|
|
1172
|
+
return { isToken: !1, value: ht(b) };
|
|
1173
|
+
if (Z[f])
|
|
1174
|
+
return { isToken: !0, value: b };
|
|
1175
1175
|
if (f.match(ft))
|
|
1176
1176
|
throw new RangeError(
|
|
1177
1177
|
"Format string contains an unescaped latin alphabet character `" + f + "`"
|
|
1178
1178
|
);
|
|
1179
|
-
return { isToken: !1, value:
|
|
1179
|
+
return { isToken: !1, value: b };
|
|
1180
1180
|
});
|
|
1181
1181
|
a.localize.preprocessor && (M = a.localize.preprocessor(d, M));
|
|
1182
1182
|
const x = {
|
|
@@ -1184,11 +1184,11 @@ function X(r, e, t) {
|
|
|
1184
1184
|
weekStartsOn: o,
|
|
1185
1185
|
locale: a
|
|
1186
1186
|
};
|
|
1187
|
-
return M.map((
|
|
1188
|
-
if (!
|
|
1189
|
-
const f =
|
|
1187
|
+
return M.map((b) => {
|
|
1188
|
+
if (!b.isToken) return b.value;
|
|
1189
|
+
const f = b.value;
|
|
1190
1190
|
(ce(f) || ue(f)) && R(f, e, String(r));
|
|
1191
|
-
const N =
|
|
1191
|
+
const N = Z[f[0]];
|
|
1192
1192
|
return N(d, f, a.localize, x);
|
|
1193
1193
|
}).join("");
|
|
1194
1194
|
}
|
|
@@ -1216,14 +1216,14 @@ function yt(r, e) {
|
|
|
1216
1216
|
r.getMilliseconds()
|
|
1217
1217
|
), t;
|
|
1218
1218
|
}
|
|
1219
|
-
const
|
|
1219
|
+
const gt = 10;
|
|
1220
1220
|
class de {
|
|
1221
1221
|
subPriority = 0;
|
|
1222
1222
|
validate(e, t) {
|
|
1223
1223
|
return !0;
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
|
-
class
|
|
1226
|
+
class bt extends de {
|
|
1227
1227
|
constructor(e, t, n, a, s) {
|
|
1228
1228
|
super(), this.value = e, this.validateValue = t, this.setValue = n, this.priority = a, s && (this.subPriority = s);
|
|
1229
1229
|
}
|
|
@@ -1235,7 +1235,7 @@ class gt extends de {
|
|
|
1235
1235
|
}
|
|
1236
1236
|
}
|
|
1237
1237
|
class pt extends de {
|
|
1238
|
-
priority =
|
|
1238
|
+
priority = gt;
|
|
1239
1239
|
subPriority = -1;
|
|
1240
1240
|
set(e, t) {
|
|
1241
1241
|
return t.timestampIsSet ? e : m(e, yt(e, Date));
|
|
@@ -1245,7 +1245,7 @@ class u {
|
|
|
1245
1245
|
run(e, t, n, a) {
|
|
1246
1246
|
const s = this.parse(e, t, n, a);
|
|
1247
1247
|
return s ? {
|
|
1248
|
-
setter: new
|
|
1248
|
+
setter: new bt(
|
|
1249
1249
|
s.value,
|
|
1250
1250
|
this.validate,
|
|
1251
1251
|
this.set,
|
|
@@ -1317,14 +1317,14 @@ const y = {
|
|
|
1317
1317
|
// 0 to 999, -0 to -999
|
|
1318
1318
|
fourDigitsSigned: /^-?\d{1,4}/
|
|
1319
1319
|
// 0 to 9999, -0 to -9999
|
|
1320
|
-
},
|
|
1320
|
+
}, D = {
|
|
1321
1321
|
basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
|
1322
1322
|
basic: /^([+-])(\d{2})(\d{2})|Z/,
|
|
1323
1323
|
basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
|
1324
1324
|
extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
|
1325
1325
|
extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
|
|
1326
1326
|
};
|
|
1327
|
-
function
|
|
1327
|
+
function g(r, e) {
|
|
1328
1328
|
return r && {
|
|
1329
1329
|
value: e(r.value),
|
|
1330
1330
|
rest: r.rest
|
|
@@ -1337,7 +1337,7 @@ function l(r, e) {
|
|
|
1337
1337
|
rest: e.slice(t[0].length)
|
|
1338
1338
|
} : null;
|
|
1339
1339
|
}
|
|
1340
|
-
function
|
|
1340
|
+
function T(r, e) {
|
|
1341
1341
|
const t = e.match(r);
|
|
1342
1342
|
if (!t)
|
|
1343
1343
|
return null;
|
|
@@ -1348,7 +1348,7 @@ function D(r, e) {
|
|
|
1348
1348
|
};
|
|
1349
1349
|
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;
|
|
1350
1350
|
return {
|
|
1351
|
-
value: n * (a * ye + s * we + o *
|
|
1351
|
+
value: n * (a * ye + s * we + o * ge),
|
|
1352
1352
|
rest: e.slice(t[0].length)
|
|
1353
1353
|
};
|
|
1354
1354
|
}
|
|
@@ -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 F(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;
|
|
@@ -1424,16 +1424,16 @@ class Mt extends u {
|
|
|
1424
1424
|
});
|
|
1425
1425
|
switch (t) {
|
|
1426
1426
|
case "y":
|
|
1427
|
-
return
|
|
1427
|
+
return g(w(4, e), a);
|
|
1428
1428
|
case "yo":
|
|
1429
|
-
return
|
|
1429
|
+
return g(
|
|
1430
1430
|
n.ordinalNumber(e, {
|
|
1431
1431
|
unit: "year"
|
|
1432
1432
|
}),
|
|
1433
1433
|
a
|
|
1434
1434
|
);
|
|
1435
1435
|
default:
|
|
1436
|
-
return
|
|
1436
|
+
return g(w(t.length, e), a);
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
1439
|
validate(e, t) {
|
|
@@ -1461,23 +1461,23 @@ class Pt extends u {
|
|
|
1461
1461
|
});
|
|
1462
1462
|
switch (t) {
|
|
1463
1463
|
case "Y":
|
|
1464
|
-
return
|
|
1464
|
+
return g(w(4, e), a);
|
|
1465
1465
|
case "Yo":
|
|
1466
|
-
return
|
|
1466
|
+
return g(
|
|
1467
1467
|
n.ordinalNumber(e, {
|
|
1468
1468
|
unit: "year"
|
|
1469
1469
|
}),
|
|
1470
1470
|
a
|
|
1471
1471
|
);
|
|
1472
1472
|
default:
|
|
1473
|
-
return
|
|
1473
|
+
return g(w(t.length, e), a);
|
|
1474
1474
|
}
|
|
1475
1475
|
}
|
|
1476
1476
|
validate(e, t) {
|
|
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,
|
|
@@ -1508,10 +1508,10 @@ class Pt extends u {
|
|
|
1508
1508
|
"T"
|
|
1509
1509
|
];
|
|
1510
1510
|
}
|
|
1511
|
-
class
|
|
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);
|
|
@@ -1535,10 +1535,10 @@ class Tt extends u {
|
|
|
1535
1535
|
"T"
|
|
1536
1536
|
];
|
|
1537
1537
|
}
|
|
1538
|
-
class
|
|
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;
|
|
@@ -1684,14 +1684,14 @@ class Yt extends u {
|
|
|
1684
1684
|
const a = (s) => s - 1;
|
|
1685
1685
|
switch (t) {
|
|
1686
1686
|
case "M":
|
|
1687
|
-
return
|
|
1687
|
+
return g(
|
|
1688
1688
|
l(y.month, e),
|
|
1689
1689
|
a
|
|
1690
1690
|
);
|
|
1691
1691
|
case "MM":
|
|
1692
|
-
return
|
|
1692
|
+
return g(w(2, e), a);
|
|
1693
1693
|
case "Mo":
|
|
1694
|
-
return
|
|
1694
|
+
return g(
|
|
1695
1695
|
n.ordinalNumber(e, {
|
|
1696
1696
|
unit: "month"
|
|
1697
1697
|
}),
|
|
@@ -1728,14 +1728,14 @@ class vt extends u {
|
|
|
1728
1728
|
const a = (s) => s - 1;
|
|
1729
1729
|
switch (t) {
|
|
1730
1730
|
case "L":
|
|
1731
|
-
return
|
|
1731
|
+
return g(
|
|
1732
1732
|
l(y.month, e),
|
|
1733
1733
|
a
|
|
1734
1734
|
);
|
|
1735
1735
|
case "LL":
|
|
1736
|
-
return
|
|
1736
|
+
return g(w(2, e), a);
|
|
1737
1737
|
case "Lo":
|
|
1738
|
-
return
|
|
1738
|
+
return g(
|
|
1739
1739
|
n.ordinalNumber(e, {
|
|
1740
1740
|
unit: "month"
|
|
1741
1741
|
}),
|
|
@@ -1872,7 +1872,7 @@ const qt = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Ht = [
|
|
|
1872
1872
|
30,
|
|
1873
1873
|
31
|
|
1874
1874
|
];
|
|
1875
|
-
class
|
|
1875
|
+
class Ft extends u {
|
|
1876
1876
|
priority = 90;
|
|
1877
1877
|
subPriority = 1;
|
|
1878
1878
|
parse(e, t, n) {
|
|
@@ -1907,7 +1907,7 @@ class Lt extends u {
|
|
|
1907
1907
|
"T"
|
|
1908
1908
|
];
|
|
1909
1909
|
}
|
|
1910
|
-
class
|
|
1910
|
+
class Lt extends u {
|
|
1911
1911
|
priority = 90;
|
|
1912
1912
|
subpriority = 1;
|
|
1913
1913
|
parse(e, t, n) {
|
|
@@ -1946,9 +1946,9 @@ class Ft extends u {
|
|
|
1946
1946
|
"T"
|
|
1947
1947
|
];
|
|
1948
1948
|
}
|
|
1949
|
-
function
|
|
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,
|
|
1951
|
-
return
|
|
1949
|
+
function A(r, e, t) {
|
|
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 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
|
}
|
|
@@ -1994,9 +1994,9 @@ class It extends u {
|
|
|
1994
1994
|
switch (t) {
|
|
1995
1995
|
case "e":
|
|
1996
1996
|
case "ee":
|
|
1997
|
-
return
|
|
1997
|
+
return g(w(t.length, e), s);
|
|
1998
1998
|
case "eo":
|
|
1999
|
-
return
|
|
1999
|
+
return g(
|
|
2000
2000
|
n.ordinalNumber(e, {
|
|
2001
2001
|
unit: "day"
|
|
2002
2002
|
}),
|
|
@@ -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",
|
|
@@ -2056,9 +2056,9 @@ class Qt extends u {
|
|
|
2056
2056
|
switch (t) {
|
|
2057
2057
|
case "c":
|
|
2058
2058
|
case "cc":
|
|
2059
|
-
return
|
|
2059
|
+
return g(w(t.length, e), s);
|
|
2060
2060
|
case "co":
|
|
2061
|
-
return
|
|
2061
|
+
return g(
|
|
2062
2062
|
n.ordinalNumber(e, {
|
|
2063
2063
|
unit: "day"
|
|
2064
2064
|
}),
|
|
@@ -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;
|
|
@@ -2123,7 +2123,7 @@ class Xt extends u {
|
|
|
2123
2123
|
case "io":
|
|
2124
2124
|
return n.ordinalNumber(e, { unit: "day" });
|
|
2125
2125
|
case "iii":
|
|
2126
|
-
return
|
|
2126
|
+
return g(
|
|
2127
2127
|
n.day(e, {
|
|
2128
2128
|
width: "abbreviated",
|
|
2129
2129
|
context: "formatting"
|
|
@@ -2137,7 +2137,7 @@ class Xt extends u {
|
|
|
2137
2137
|
a
|
|
2138
2138
|
);
|
|
2139
2139
|
case "iiiii":
|
|
2140
|
-
return
|
|
2140
|
+
return g(
|
|
2141
2141
|
n.day(e, {
|
|
2142
2142
|
width: "narrow",
|
|
2143
2143
|
context: "formatting"
|
|
@@ -2145,7 +2145,7 @@ class Xt extends u {
|
|
|
2145
2145
|
a
|
|
2146
2146
|
);
|
|
2147
2147
|
case "iiiiii":
|
|
2148
|
-
return
|
|
2148
|
+
return g(
|
|
2149
2149
|
n.day(e, {
|
|
2150
2150
|
width: "short",
|
|
2151
2151
|
context: "formatting"
|
|
@@ -2157,7 +2157,7 @@ class Xt extends u {
|
|
|
2157
2157
|
);
|
|
2158
2158
|
case "iiii":
|
|
2159
2159
|
default:
|
|
2160
|
-
return
|
|
2160
|
+
return g(
|
|
2161
2161
|
n.day(e, {
|
|
2162
2162
|
width: "wide",
|
|
2163
2163
|
context: "formatting"
|
|
@@ -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
|
}
|
|
@@ -2439,7 +2439,7 @@ class Kt extends u {
|
|
|
2439
2439
|
priority = 30;
|
|
2440
2440
|
parse(e, t) {
|
|
2441
2441
|
const n = (a) => Math.trunc(a * Math.pow(10, -t.length + 3));
|
|
2442
|
-
return
|
|
2442
|
+
return g(w(t.length, e), n);
|
|
2443
2443
|
}
|
|
2444
2444
|
set(e, t, n) {
|
|
2445
2445
|
return e.setMilliseconds(n), e;
|
|
@@ -2451,31 +2451,31 @@ class Ut extends u {
|
|
|
2451
2451
|
parse(e, t) {
|
|
2452
2452
|
switch (t) {
|
|
2453
2453
|
case "X":
|
|
2454
|
-
return
|
|
2455
|
-
|
|
2454
|
+
return T(
|
|
2455
|
+
D.basicOptionalMinutes,
|
|
2456
2456
|
e
|
|
2457
2457
|
);
|
|
2458
2458
|
case "XX":
|
|
2459
|
-
return D
|
|
2459
|
+
return T(D.basic, e);
|
|
2460
2460
|
case "XXXX":
|
|
2461
|
-
return
|
|
2462
|
-
|
|
2461
|
+
return T(
|
|
2462
|
+
D.basicOptionalSeconds,
|
|
2463
2463
|
e
|
|
2464
2464
|
);
|
|
2465
2465
|
case "XXXXX":
|
|
2466
|
-
return
|
|
2467
|
-
|
|
2466
|
+
return T(
|
|
2467
|
+
D.extendedOptionalSeconds,
|
|
2468
2468
|
e
|
|
2469
2469
|
);
|
|
2470
2470
|
case "XXX":
|
|
2471
2471
|
default:
|
|
2472
|
-
return D
|
|
2472
|
+
return T(D.extended, e);
|
|
2473
2473
|
}
|
|
2474
2474
|
}
|
|
2475
2475
|
set(e, t, n) {
|
|
2476
2476
|
return t.timestampIsSet ? e : m(
|
|
2477
2477
|
e,
|
|
2478
|
-
e.getTime() -
|
|
2478
|
+
e.getTime() - F(e) - n
|
|
2479
2479
|
);
|
|
2480
2480
|
}
|
|
2481
2481
|
incompatibleTokens = ["t", "T", "x"];
|
|
@@ -2485,31 +2485,31 @@ class St extends u {
|
|
|
2485
2485
|
parse(e, t) {
|
|
2486
2486
|
switch (t) {
|
|
2487
2487
|
case "x":
|
|
2488
|
-
return
|
|
2489
|
-
|
|
2488
|
+
return T(
|
|
2489
|
+
D.basicOptionalMinutes,
|
|
2490
2490
|
e
|
|
2491
2491
|
);
|
|
2492
2492
|
case "xx":
|
|
2493
|
-
return D
|
|
2493
|
+
return T(D.basic, e);
|
|
2494
2494
|
case "xxxx":
|
|
2495
|
-
return
|
|
2496
|
-
|
|
2495
|
+
return T(
|
|
2496
|
+
D.basicOptionalSeconds,
|
|
2497
2497
|
e
|
|
2498
2498
|
);
|
|
2499
2499
|
case "xxxxx":
|
|
2500
|
-
return
|
|
2501
|
-
|
|
2500
|
+
return T(
|
|
2501
|
+
D.extendedOptionalSeconds,
|
|
2502
2502
|
e
|
|
2503
2503
|
);
|
|
2504
2504
|
case "xxx":
|
|
2505
2505
|
default:
|
|
2506
|
-
return D
|
|
2506
|
+
return T(D.extended, e);
|
|
2507
2507
|
}
|
|
2508
2508
|
}
|
|
2509
2509
|
set(e, t, n) {
|
|
2510
2510
|
return t.timestampIsSet ? e : m(
|
|
2511
2511
|
e,
|
|
2512
|
-
e.getTime() -
|
|
2512
|
+
e.getTime() - F(e) - n
|
|
2513
2513
|
);
|
|
2514
2514
|
}
|
|
2515
2515
|
incompatibleTokens = ["t", "T", "X"];
|
|
@@ -2538,16 +2538,16 @@ const nn = {
|
|
|
2538
2538
|
G: new xt(),
|
|
2539
2539
|
y: new Mt(),
|
|
2540
2540
|
Y: new Pt(),
|
|
2541
|
-
R: new
|
|
2542
|
-
u: new
|
|
2541
|
+
R: new Dt(),
|
|
2542
|
+
u: new Tt(),
|
|
2543
2543
|
Q: new kt(),
|
|
2544
2544
|
q: new Ot(),
|
|
2545
2545
|
M: new Yt(),
|
|
2546
2546
|
L: new vt(),
|
|
2547
2547
|
w: new Wt(),
|
|
2548
2548
|
I: new Nt(),
|
|
2549
|
-
d: new
|
|
2550
|
-
D: new
|
|
2549
|
+
d: new Ft(),
|
|
2550
|
+
D: new Lt(),
|
|
2551
2551
|
E: new Ct(),
|
|
2552
2552
|
e: new It(),
|
|
2553
2553
|
c: new Qt(),
|
|
@@ -2575,7 +2575,7 @@ function dn(r, e, t, n) {
|
|
|
2575
2575
|
firstWeekContainsDate: o,
|
|
2576
2576
|
weekStartsOn: d,
|
|
2577
2577
|
locale: s
|
|
2578
|
-
}, x = [new pt()],
|
|
2578
|
+
}, x = [new pt()], b = e.match(an).map((i) => {
|
|
2579
2579
|
const h = i[0];
|
|
2580
2580
|
if (h in Q) {
|
|
2581
2581
|
const P = Q[h];
|
|
@@ -2583,18 +2583,18 @@ function dn(r, e, t, n) {
|
|
|
2583
2583
|
}
|
|
2584
2584
|
return i;
|
|
2585
2585
|
}).join("").match(rn), f = [];
|
|
2586
|
-
for (let i of
|
|
2586
|
+
for (let i of b) {
|
|
2587
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
|
-
(
|
|
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(
|
|
@@ -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,17 +2651,25 @@ 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
|
-
const
|
|
2660
|
-
|
|
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
|
+
if (t) {
|
|
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
|
+
return {
|
|
2663
|
+
start: n.toISOString(),
|
|
2664
|
+
// Format in ISO 8601
|
|
2665
|
+
end: a.toISOString()
|
|
2666
|
+
};
|
|
2667
|
+
}
|
|
2668
|
+
return { start: null, end: null };
|
|
2661
2669
|
}
|
|
2662
2670
|
export {
|
|
2663
2671
|
hn as formatDate,
|
|
2664
2672
|
mn as formatDateToddMMYYYY,
|
|
2665
|
-
yn as
|
|
2673
|
+
yn as getStartAndEndOfDayUTC,
|
|
2666
2674
|
wn as subtractDaysFromDate
|
|
2667
2675
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("./ArrayUtils.cjs"),p=require("./ColorUtils.cjs"),a=require("./CookieUtils.cjs"),C=require("./CurrencyUtils.cjs"),n=require("./DateUtils.cjs"),s=require("./DeviceDetectionUtils.cjs"),l=require("./DOMUtils.cjs"),c=require("./EmailUtils.cjs"),E=require("./FunctionUtils.cjs"),u=require("./GenericUtils.cjs"),t=require("./NumberUtils.cjs"),r=require("./ObjectUtils.cjs"),S=require("./ObserverUtils.cjs"),m=require("./PermissionUtils.cjs"),d=require("./RESB_UrlBuilder.cjs"),o=require("./StringUtils.cjs"),y=require("./URLBuilderUtils.cjs"),e=require("./RegexUtils.cjs"),g=require("./GeolocationUtils.cjs"),b=require("./AdressUtils.cjs"),P=require("./GAutocompleteUtils.cjs"),U=require("./DownloadUtils.cjs"),i=require("./MapUtils.cjs");exports.isArrNullOrEmpty=O.isArrNullOrEmpty;exports.rgba=p.rgba;exports.decodeCookie=a.decodeCookie;exports.encodeCookie=a.encodeCookie;exports.getCookie=a.getCookie;exports.removeCookie=a.removeCookie;exports.formatCurrency=C.formatCurrency;exports.formatDate=n.formatDate;exports.formatDateToddMMYYYY=n.formatDateToddMMYYYY;exports.getStartAndEndOfDayUTC=n.getStartAndEndOfDayUTC;exports.subtractDaysFromDate=n.subtractDaysFromDate;exports.getCurrentDeviceSize=s.getCurrentDeviceSize;exports.isMobile=s.isMobile;exports.isSafari=s.isSafari;exports.isWindows=s.isWindows;exports.isiOSDevice=s.isiOSDevice;exports.emptyElem=l.emptyElem;exports.getSingleElement=l.getSingleElement;exports.hideElem=l.hideElem;exports.showElem=l.showElem;exports.hash256=c.hash256;exports.hashEmail=c.hashEmail;exports.debounce=E.debounce;exports.isPromise=E.isPromise;exports.awaitableSetTimeout=u.awaitableSetTimeout;exports.createCustomEvent=u.createCustomEvent;exports.formatFloat=t.formatFloat;exports.formatInteger=t.formatInteger;exports.formatLocaleNumber=t.formatLocaleNumber;exports.formatLocaleNumberAuto=t.formatLocaleNumberAuto;exports.formatNumber=t.formatNumber;exports.formatterNumberObj=t.formatterNumberObj;exports.parseLocaleNumber=t.parseLocaleNumber;exports.parseLocaleNumberAuto=t.parseLocaleNumberAuto;exports.deepCopy=r.deepCopy;exports.getOrNull=r.getOrNull;exports.invertFlatObject=r.invertFlatObject;exports.invertKeyToValue=r.invertKeyToValue;exports.isEmptyObject=r.isEmptyObject;exports.shallowCopyObjectTo=r.shallowCopyObjectTo;exports.observeOnce=S.observeOnce;exports.addPermissionStateListener=m.addPermissionStateListener;exports.onNotificationsPermissionChange=m.onNotificationsPermissionChange;exports.buildParams=d.buildParams;exports.buildURL=d.buildURL;exports.capitalizeFirstLetter=o.capitalizeFirstLetter;exports.cleanASCII=o.cleanASCII;exports.decodeTextWithEntities=o.decodeTextWithEntities;exports.replaceAll=o.replaceAll;exports.replaceAllTokens=o.replaceAllTokens;exports.stringToHyphened=o.stringToHyphened;exports.appendQueryString=y.appendQueryString;exports.COMPETITOR_REGEX=e.COMPETITOR_REGEX;exports.DATE_REGEX=e.DATE_REGEX;exports.EMAIL_REGEX=e.EMAIL_REGEX;exports.EMAIL_REGEX_INTO_TEXT=e.EMAIL_REGEX_INTO_TEXT;exports.EXCLUDED_REGEX=e.EXCLUDED_REGEX;exports.GLOBAL_PHONE_REGEX=e.GLOBAL_PHONE_REGEX;exports.PASSWORD_REGEX=e.PASSWORD_REGEX;exports.PHONE_REGEX=e.PHONE_REGEX;exports.ROOMS_REGEX=e.ROOMS_REGEX;exports.SQM_REGEX=e.SQM_REGEX;exports.browserSupportGeolocation=g.browserSupportGeolocation;exports.getUserPosition=g.getUserPosition;exports.formatAddress=b.formatAddress;exports.formattedAddress=b.formattedAddress;exports.googlePlaceConverter=P.googlePlaceConverter;exports.downloadFile=U.downloadFile;exports.calcPolygonCenter=i.calcPolygonCenter;exports.encodePolygon=i.encodePolygon;exports.getMinMaxLatLng=i.getMinMaxLatLng;exports.getPolygonString=i.getPolygonString;exports.parsePoints=i.parsePoints;exports.removeDuplicatePoints=i.removeDuplicatePoints;
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { isArrNullOrEmpty as r } from "./ArrayUtils.js";
|
|
2
2
|
import { rgba as a } from "./ColorUtils.js";
|
|
3
|
-
import { decodeCookie as i, encodeCookie as l, getCookie as
|
|
3
|
+
import { decodeCookie as i, encodeCookie as l, getCookie as n, removeCookie as p } from "./CookieUtils.js";
|
|
4
4
|
import { formatCurrency as E } from "./CurrencyUtils.js";
|
|
5
|
-
import { formatDate as c, formatDateToddMMYYYY as d,
|
|
6
|
-
import { getCurrentDeviceSize as b, isMobile as O, isSafari as C, isWindows as P, isiOSDevice as
|
|
7
|
-
import { emptyElem as
|
|
5
|
+
import { formatDate as c, formatDateToddMMYYYY as d, getStartAndEndOfDayUTC as x, subtractDaysFromDate as u } from "./DateUtils.js";
|
|
6
|
+
import { getCurrentDeviceSize as b, isMobile as O, isSafari as C, isWindows as P, isiOSDevice as S } from "./DeviceDetectionUtils.js";
|
|
7
|
+
import { emptyElem as A, getSingleElement as L, hideElem as R, showElem as T } from "./DOMUtils.js";
|
|
8
8
|
import { hash256 as D, hashEmail as G } from "./EmailUtils.js";
|
|
9
9
|
import { debounce as X, isPromise as h } from "./FunctionUtils.js";
|
|
10
10
|
import { awaitableSetTimeout as v, createCustomEvent as I } from "./GenericUtils.js";
|
|
11
|
-
import { formatFloat as k, formatInteger as F, formatLocaleNumber as j, formatLocaleNumberAuto as
|
|
11
|
+
import { formatFloat as k, formatInteger as F, formatLocaleNumber as j, formatLocaleNumberAuto as U, formatNumber as Y, formatterNumberObj as H, parseLocaleNumber as W, parseLocaleNumberAuto as z } from "./NumberUtils.js";
|
|
12
12
|
import { deepCopy as B, getOrNull as K, invertFlatObject as V, invertKeyToValue as q, isEmptyObject as J, shallowCopyObjectTo as Z } from "./ObjectUtils.js";
|
|
13
13
|
import { observeOnce as ee } from "./ObserverUtils.js";
|
|
14
14
|
import { addPermissionStateListener as re, onNotificationsPermissionChange as te } from "./PermissionUtils.js";
|
|
15
15
|
import { buildParams as me, buildURL as ie } from "./RESB_UrlBuilder.js";
|
|
16
|
-
import { capitalizeFirstLetter as
|
|
16
|
+
import { capitalizeFirstLetter as ne, cleanASCII as pe, decodeTextWithEntities as se, replaceAll as Ee, replaceAllTokens as fe, stringToHyphened as ce } from "./StringUtils.js";
|
|
17
17
|
import { appendQueryString as xe } from "./URLBuilderUtils.js";
|
|
18
|
-
import { COMPETITOR_REGEX as ge, DATE_REGEX as be, EMAIL_REGEX as Oe, EMAIL_REGEX_INTO_TEXT as Ce, EXCLUDED_REGEX as Pe, GLOBAL_PHONE_REGEX as
|
|
18
|
+
import { COMPETITOR_REGEX as ge, DATE_REGEX as be, EMAIL_REGEX as Oe, EMAIL_REGEX_INTO_TEXT as Ce, EXCLUDED_REGEX as Pe, GLOBAL_PHONE_REGEX as Se, PASSWORD_REGEX as ye, PHONE_REGEX as Ae, ROOMS_REGEX as Le, SQM_REGEX as Re } from "./RegexUtils.js";
|
|
19
19
|
import { browserSupportGeolocation as _e, getUserPosition as De } from "./GeolocationUtils.js";
|
|
20
20
|
import { formatAddress as Ne, formattedAddress as Xe } from "./AdressUtils.js";
|
|
21
21
|
import { googlePlaceConverter as Me } from "./GAutocompleteUtils.js";
|
|
22
22
|
import { downloadFile as Ie } from "./DownloadUtils.js";
|
|
23
|
-
import { calcPolygonCenter as ke, encodePolygon as Fe, getMinMaxLatLng as je, getPolygonString as
|
|
23
|
+
import { calcPolygonCenter as ke, encodePolygon as Fe, getMinMaxLatLng as je, getPolygonString as Ue, parsePoints as Ye, removeDuplicatePoints as He } from "./MapUtils.js";
|
|
24
24
|
export {
|
|
25
25
|
ge as COMPETITOR_REGEX,
|
|
26
26
|
be as DATE_REGEX,
|
|
27
27
|
Oe as EMAIL_REGEX,
|
|
28
28
|
Ce as EMAIL_REGEX_INTO_TEXT,
|
|
29
29
|
Pe as EXCLUDED_REGEX,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
Se as GLOBAL_PHONE_REGEX,
|
|
31
|
+
ye as PASSWORD_REGEX,
|
|
32
|
+
Ae as PHONE_REGEX,
|
|
33
|
+
Le as ROOMS_REGEX,
|
|
34
|
+
Re as SQM_REGEX,
|
|
35
35
|
re as addPermissionStateListener,
|
|
36
36
|
xe as appendQueryString,
|
|
37
37
|
v as awaitableSetTimeout,
|
|
@@ -39,15 +39,15 @@ export {
|
|
|
39
39
|
me as buildParams,
|
|
40
40
|
ie as buildURL,
|
|
41
41
|
ke as calcPolygonCenter,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
ne as capitalizeFirstLetter,
|
|
43
|
+
pe as cleanASCII,
|
|
44
44
|
I as createCustomEvent,
|
|
45
45
|
X as debounce,
|
|
46
46
|
i as decodeCookie,
|
|
47
47
|
se as decodeTextWithEntities,
|
|
48
48
|
B as deepCopy,
|
|
49
49
|
Ie as downloadFile,
|
|
50
|
-
|
|
50
|
+
A as emptyElem,
|
|
51
51
|
l as encodeCookie,
|
|
52
52
|
Fe as encodePolygon,
|
|
53
53
|
Ne as formatAddress,
|
|
@@ -57,21 +57,22 @@ export {
|
|
|
57
57
|
k as formatFloat,
|
|
58
58
|
F as formatInteger,
|
|
59
59
|
j as formatLocaleNumber,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
U as formatLocaleNumberAuto,
|
|
61
|
+
Y as formatNumber,
|
|
62
62
|
Xe as formattedAddress,
|
|
63
63
|
H as formatterNumberObj,
|
|
64
|
-
|
|
64
|
+
n as getCookie,
|
|
65
65
|
b as getCurrentDeviceSize,
|
|
66
66
|
je as getMinMaxLatLng,
|
|
67
67
|
K as getOrNull,
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
Ue as getPolygonString,
|
|
69
|
+
L as getSingleElement,
|
|
70
|
+
x as getStartAndEndOfDayUTC,
|
|
70
71
|
De as getUserPosition,
|
|
71
72
|
Me as googlePlaceConverter,
|
|
72
73
|
D as hash256,
|
|
73
74
|
G as hashEmail,
|
|
74
|
-
|
|
75
|
+
R as hideElem,
|
|
75
76
|
V as invertFlatObject,
|
|
76
77
|
q as invertKeyToValue,
|
|
77
78
|
r as isArrNullOrEmpty,
|
|
@@ -80,14 +81,13 @@ export {
|
|
|
80
81
|
h as isPromise,
|
|
81
82
|
C as isSafari,
|
|
82
83
|
P as isWindows,
|
|
83
|
-
|
|
84
|
-
x as normalizeDate,
|
|
84
|
+
S as isiOSDevice,
|
|
85
85
|
ee as observeOnce,
|
|
86
86
|
te as onNotificationsPermissionChange,
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
W as parseLocaleNumber,
|
|
88
|
+
z as parseLocaleNumberAuto,
|
|
89
|
+
Ye as parsePoints,
|
|
90
|
+
p as removeCookie,
|
|
91
91
|
He as removeDuplicatePoints,
|
|
92
92
|
Ee as replaceAll,
|
|
93
93
|
fe as replaceAllTokens,
|
|
@@ -15,22 +15,13 @@ export declare const formatDateToddMMYYYY: (date: Date | string) => string;
|
|
|
15
15
|
*/
|
|
16
16
|
export declare const subtractDaysFromDate: (initialDate: Date | undefined, days: number) => Date;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* - yyyy-MM-dd
|
|
24
|
-
* - yyyy/MM/dd
|
|
25
|
-
* - dd/MM/yyyy
|
|
26
|
-
* - dd-MM-yyyy
|
|
27
|
-
*
|
|
28
|
-
* @returns {string|null} The normalized date in 'yyyy-MM-dd' format if valid,
|
|
29
|
-
* null if the date cannot be parsed in any of the supported formats.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* normalizeDate('2024-03-25') // returns '2024-03-25'
|
|
33
|
-
* normalizeDate('25/03/2024') // returns '2024-03-25'
|
|
34
|
-
* normalizeDate('invalid') // returns null
|
|
18
|
+
* Gets the start and end timestamps of a day in UTC format based on a date string.
|
|
19
|
+
* @param {string} keyword - The date string to parse. Accepts formats: "yyyy-MM-dd", "yyyy/MM/dd", "dd/MM/yyyy", "dd-MM-yyyy"
|
|
20
|
+
* @returns {Object} An object containing:
|
|
21
|
+
* - start: ISO 8601 formatted string representing start of day (00:00:00 UTC) or null if invalid date
|
|
22
|
+
* - end: ISO 8601 formatted string representing end of day (23:59:59 UTC) or null if invalid date
|
|
35
23
|
*/
|
|
36
|
-
export declare function
|
|
24
|
+
export declare function getStartAndEndOfDayUTC(keyword: string): {
|
|
25
|
+
start: string | null;
|
|
26
|
+
end: string | null;
|
|
27
|
+
};
|