just-validate-plugin-date
Version:
Date plugin for JustValidate
2 lines (1 loc) • 35.1 kB
JavaScript
(function(M,U){typeof exports=="object"&&typeof module!="undefined"?module.exports=U():typeof define=="function"&&define.amd?define(U):(M=typeof globalThis!="undefined"?globalThis:M||self,M.JustValidatePluginDate=U())})(this,function(){"use strict";var M={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"}},U=function(e,r,t){var n,a=M[e];return typeof a=="string"?n=a:r===1?n=a.one:n=a.other.replace("{{count}}",r.toString()),t!=null&&t.addSuffix?t.comparison&&t.comparison>0?"in "+n:n+" ago":n},me=U;function X(e){return function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=r.width?String(r.width):e.defaultWidth,n=e.formats[t]||e.formats[e.defaultWidth];return n}}var we={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ve={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},pe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ye={date:X({formats:we,defaultWidth:"full"}),time:X({formats:ve,defaultWidth:"full"}),dateTime:X({formats:pe,defaultWidth:"full"})},be=ye,Te={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ge=function(e,r,t,n){return Te[e]},Ce=ge;function S(e){return function(r,t){var n=t||{},a=n.context?String(n.context):"standalone",i;if(a==="formatting"&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,s=n.width?String(n.width):o;i=e.formattingValues[s]||e.formattingValues[o]}else{var u=e.defaultWidth,h=n.width?String(n.width):e.defaultWidth;i=e.values[h]||e.values[u]}var b=e.argumentCallback?e.argumentCallback(r):r;return i[b]}}var De={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},_e={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},xe={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"]},ke={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"]},Pe={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"}},Me={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"}},Ue=function(e,r){var t=Number(e),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"},Se={ordinalNumber:Ue,era:S({values:De,defaultWidth:"wide"}),quarter:S({values:_e,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:S({values:xe,defaultWidth:"wide"}),day:S({values:ke,defaultWidth:"wide"}),dayPeriod:S({values:Pe,defaultWidth:"wide",formattingValues:Me,defaultFormattingWidth:"wide"})},Ye=Se;function Y(e){return function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=r.match(a);if(!i)return null;var o=i[0],s=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(s)?Ee(s,function(y){return y.test(o)}):Oe(s,function(y){return y.test(o)}),h;h=e.valueCallback?e.valueCallback(u):u,h=t.valueCallback?t.valueCallback(h):h;var b=r.slice(o.length);return{value:h,rest:b}}}function Oe(e,r){for(var t in e)if(e.hasOwnProperty(t)&&r(e[t]))return t}function Ee(e,r){for(var t=0;t<e.length;t++)if(r(e[t]))return t}function We(e){return function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.match(e.matchPattern);if(!n)return null;var a=n[0],i=r.match(e.parsePattern);if(!i)return null;var o=e.valueCallback?e.valueCallback(i[0]):i[0];o=t.valueCallback?t.valueCallback(o):o;var s=r.slice(a.length);return{value:o,rest:s}}}var Ne=/^(\d+)(th|st|nd|rd)?/i,qe=/\d+/i,Ie={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},Fe={any:[/^b/i,/^(a|c)/i]},He={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Re={any:[/1/i,/2/i,/3/i,/4/i]},Le={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},Ae={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]},Qe={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},Be={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]},Xe={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},je={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}},Ge={ordinalNumber:We({matchPattern:Ne,parsePattern:qe,valueCallback:function(e){return parseInt(e,10)}}),era:Y({matchPatterns:Ie,defaultMatchWidth:"wide",parsePatterns:Fe,defaultParseWidth:"any"}),quarter:Y({matchPatterns:He,defaultMatchWidth:"wide",parsePatterns:Re,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:Y({matchPatterns:Le,defaultMatchWidth:"wide",parsePatterns:Ae,defaultParseWidth:"any"}),day:Y({matchPatterns:Qe,defaultMatchWidth:"wide",parsePatterns:Be,defaultParseWidth:"any"}),dayPeriod:Y({matchPatterns:Xe,defaultMatchWidth:"any",parsePatterns:je,defaultParseWidth:"any"})},ze=Ge,Je={code:"en-US",formatDistance:me,formatLong:be,formatRelative:Ce,localize:Ye,match:ze,options:{weekStartsOn:0,firstWeekContainsDate:1}},Ve=Je;function m(e){if(e===null||e===!0||e===!1)return NaN;var r=Number(e);return isNaN(r)?r:r<0?Math.ceil(r):Math.floor(r)}function l(e,r){if(r.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+r.length+" present")}function w(e){l(1,arguments);var r=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&r==="[object Date]"?new Date(e.getTime()):typeof e=="number"||r==="[object Number]"?new Date(e):((typeof e=="string"||r==="[object String]")&&typeof console!="undefined"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn(new Error().stack)),new Date(NaN))}function $e(e,r){l(2,arguments);var t=w(e).getTime(),n=m(r);return new Date(t+n)}function Ke(e,r){l(2,arguments);var t=m(r);return $e(e,-t)}function Ze(e,r){if(e==null)throw new TypeError("assign requires that input parameter not be null or undefined");r=r||{};for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e}function Z(e,r){switch(e){case"P":return r.date({width:"short"});case"PP":return r.date({width:"medium"});case"PPP":return r.date({width:"long"});case"PPPP":default:return r.date({width:"full"})}}function ee(e,r){switch(e){case"p":return r.time({width:"short"});case"pp":return r.time({width:"medium"});case"ppp":return r.time({width:"long"});case"pppp":default:return r.time({width:"full"})}}function et(e,r){var t=e.match(/(P+)(p+)?/)||[],n=t[1],a=t[2];if(!a)return Z(e,r);var i;switch(n){case"P":i=r.dateTime({width:"short"});break;case"PP":i=r.dateTime({width:"medium"});break;case"PPP":i=r.dateTime({width:"long"});break;case"PPPP":default:i=r.dateTime({width:"full"});break}return i.replace("{{date}}",Z(n,r)).replace("{{time}}",ee(a,r))}var tt={p:ee,P:et},rt=tt;function nt(e){var r=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return r.setUTCFullYear(e.getFullYear()),e.getTime()-r.getTime()}var at=["D","DD"],it=["YY","YYYY"];function ot(e){return at.indexOf(e)!==-1}function st(e){return it.indexOf(e)!==-1}function te(e,r,t){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(r,"`) for formatting years to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(r,"`) for formatting years to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(r,"`) for formatting days of the month to the input `").concat(t,"`; see: https://git.io/fxCyr"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(r,"`) for formatting days of the month to the input `").concat(t,"`; see: https://git.io/fxCyr"))}function x(e,r){l(1,arguments);var t=r||{},n=t.locale,a=n&&n.options&&n.options.weekStartsOn,i=a==null?0:m(a),o=t.weekStartsOn==null?i:m(t.weekStartsOn);if(!(o>=0&&o<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var s=w(e),u=s.getUTCDay(),h=(u<o?7:0)+u-o;return s.setUTCDate(s.getUTCDate()-h),s.setUTCHours(0,0,0,0),s}function re(e,r){l(1,arguments);var t=w(e),n=t.getUTCFullYear(),a=r||{},i=a.locale,o=i&&i.options&&i.options.firstWeekContainsDate,s=o==null?1:m(o),u=a.firstWeekContainsDate==null?s:m(a.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var h=new Date(0);h.setUTCFullYear(n+1,0,u),h.setUTCHours(0,0,0,0);var b=x(h,r),y=new Date(0);y.setUTCFullYear(n,0,u),y.setUTCHours(0,0,0,0);var E=x(y,r);return t.getTime()>=b.getTime()?n+1:t.getTime()>=E.getTime()?n:n-1}function j(e,r,t){l(2,arguments);var n=t||{},a=n.locale,i=a&&a.options&&a.options.weekStartsOn,o=i==null?0:m(i),s=n.weekStartsOn==null?o:m(n.weekStartsOn);if(!(s>=0&&s<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=w(e),h=m(r),b=u.getUTCDay(),y=h%7,E=(y+7)%7,W=(E<s?7:0)+h-b;return u.setUTCDate(u.getUTCDate()+W),u}function ut(e,r){l(2,arguments);var t=m(r);t%7==0&&(t=t-7);var n=1,a=w(e),i=a.getUTCDay(),o=t%7,s=(o+7)%7,u=(s<n?7:0)+t-i;return a.setUTCDate(a.getUTCDate()+u),a}function k(e){l(1,arguments);var r=1,t=w(e),n=t.getUTCDay(),a=(n<r?7:0)+n-r;return t.setUTCDate(t.getUTCDate()-a),t.setUTCHours(0,0,0,0),t}function dt(e){l(1,arguments);var r=w(e),t=r.getUTCFullYear(),n=new Date(0);n.setUTCFullYear(t+1,0,4),n.setUTCHours(0,0,0,0);var a=k(n),i=new Date(0);i.setUTCFullYear(t,0,4),i.setUTCHours(0,0,0,0);var o=k(i);return r.getTime()>=a.getTime()?t+1:r.getTime()>=o.getTime()?t:t-1}function ct(e){l(1,arguments);var r=dt(e),t=new Date(0);t.setUTCFullYear(r,0,4),t.setUTCHours(0,0,0,0);var n=k(t);return n}var lt=6048e5;function ft(e){l(1,arguments);var r=w(e),t=k(r).getTime()-ct(r).getTime();return Math.round(t/lt)+1}function ht(e,r){l(2,arguments);var t=w(e),n=m(r),a=ft(t)-n;return t.setUTCDate(t.getUTCDate()-a*7),t}function mt(e,r){l(1,arguments);var t=r||{},n=t.locale,a=n&&n.options&&n.options.firstWeekContainsDate,i=a==null?1:m(a),o=t.firstWeekContainsDate==null?i:m(t.firstWeekContainsDate),s=re(e,r),u=new Date(0);u.setUTCFullYear(s,0,o),u.setUTCHours(0,0,0,0);var h=x(u,r);return h}var wt=6048e5;function vt(e,r){l(1,arguments);var t=w(e),n=x(t,r).getTime()-mt(t,r).getTime();return Math.round(n/wt)+1}function pt(e,r,t){l(2,arguments);var n=w(e),a=m(r),i=vt(n,t)-a;return n.setUTCDate(n.getUTCDate()-i*7),n}var yt=36e5,bt=6e4,Tt=1e3,f={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}/},g={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 d(e,r,t){var n=r.match(e);if(!n)return null;var a=parseInt(n[0],10);return{value:t?t(a):a,rest:r.slice(n[0].length)}}function C(e,r){var t=r.match(e);if(!t)return null;if(t[0]==="Z")return{value:0,rest:r.slice(1)};var n=t[1]==="+"?1:-1,a=t[2]?parseInt(t[2],10):0,i=t[3]?parseInt(t[3],10):0,o=t[5]?parseInt(t[5],10):0;return{value:n*(a*yt+i*bt+o*Tt),rest:r.slice(t[0].length)}}function ne(e,r){return d(f.anyDigitsSigned,e,r)}function c(e,r,t){switch(e){case 1:return d(f.singleDigit,r,t);case 2:return d(f.twoDigits,r,t);case 3:return d(f.threeDigits,r,t);case 4:return d(f.fourDigits,r,t);default:return d(new RegExp("^\\d{1,"+e+"}"),r,t)}}function H(e,r,t){switch(e){case 1:return d(f.singleDigitSigned,r,t);case 2:return d(f.twoDigitsSigned,r,t);case 3:return d(f.threeDigitsSigned,r,t);case 4:return d(f.fourDigitsSigned,r,t);default:return d(new RegExp("^-?\\d{1,"+e+"}"),r,t)}}function G(e){switch(e){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 ae(e,r){var t=r>0,n=t?r:1-r,a;if(n<=50)a=e||100;else{var i=n+50,o=Math.floor(i/100)*100,s=e>=i%100;a=e+o-(s?100:0)}return t?a:1-a}var gt=[31,28,31,30,31,30,31,31,30,31,30,31],Ct=[31,29,31,30,31,30,31,31,30,31,30,31];function ie(e){return e%400==0||e%4==0&&e%100!=0}var Dt={G:{priority:140,parse:function(e,r,t,n){switch(r){case"G":case"GG":case"GGG":return t.era(e,{width:"abbreviated"})||t.era(e,{width:"narrow"});case"GGGGG":return t.era(e,{width:"narrow"});case"GGGG":default:return t.era(e,{width:"wide"})||t.era(e,{width:"abbreviated"})||t.era(e,{width:"narrow"})}},set:function(e,r,t,n){return r.era=t,e.setUTCFullYear(t,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["R","u","t","T"]},y:{priority:130,parse:function(e,r,t,n){var a=function(i){return{year:i,isTwoDigitYear:r==="yy"}};switch(r){case"y":return c(4,e,a);case"yo":return t.ordinalNumber(e,{unit:"year",valueCallback:a});default:return c(r.length,e,a)}},validate:function(e,r,t){return r.isTwoDigitYear||r.year>0},set:function(e,r,t,n){var a=e.getUTCFullYear();if(t.isTwoDigitYear){var i=ae(t.year,a);return e.setUTCFullYear(i,0,1),e.setUTCHours(0,0,0,0),e}var o=!("era"in r)||r.era===1?t.year:1-t.year;return e.setUTCFullYear(o,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","u","w","I","i","e","c","t","T"]},Y:{priority:130,parse:function(e,r,t,n){var a=function(i){return{year:i,isTwoDigitYear:r==="YY"}};switch(r){case"Y":return c(4,e,a);case"Yo":return t.ordinalNumber(e,{unit:"year",valueCallback:a});default:return c(r.length,e,a)}},validate:function(e,r,t){return r.isTwoDigitYear||r.year>0},set:function(e,r,t,n){var a=re(e,n);if(t.isTwoDigitYear){var i=ae(t.year,a);return e.setUTCFullYear(i,0,n.firstWeekContainsDate),e.setUTCHours(0,0,0,0),x(e,n)}var o=!("era"in r)||r.era===1?t.year:1-t.year;return e.setUTCFullYear(o,0,n.firstWeekContainsDate),e.setUTCHours(0,0,0,0),x(e,n)},incompatibleTokens:["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:{priority:130,parse:function(e,r,t,n){return H(r==="R"?4:r.length,e)},set:function(e,r,t,n){var a=new Date(0);return a.setUTCFullYear(t,0,4),a.setUTCHours(0,0,0,0),k(a)},incompatibleTokens:["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:{priority:130,parse:function(e,r,t,n){return H(r==="u"?4:r.length,e)},set:function(e,r,t,n){return e.setUTCFullYear(t,0,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["G","y","Y","R","w","I","i","e","c","t","T"]},Q:{priority:120,parse:function(e,r,t,n){switch(r){case"Q":case"QQ":return c(r.length,e);case"Qo":return t.ordinalNumber(e,{unit:"quarter"});case"QQQ":return t.quarter(e,{width:"abbreviated",context:"formatting"})||t.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return t.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(e,{width:"wide",context:"formatting"})||t.quarter(e,{width:"abbreviated",context:"formatting"})||t.quarter(e,{width:"narrow",context:"formatting"})}},validate:function(e,r,t){return r>=1&&r<=4},set:function(e,r,t,n){return e.setUTCMonth((t-1)*3,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:{priority:120,parse:function(e,r,t,n){switch(r){case"q":case"qq":return c(r.length,e);case"qo":return t.ordinalNumber(e,{unit:"quarter"});case"qqq":return t.quarter(e,{width:"abbreviated",context:"standalone"})||t.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return t.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(e,{width:"wide",context:"standalone"})||t.quarter(e,{width:"abbreviated",context:"standalone"})||t.quarter(e,{width:"narrow",context:"standalone"})}},validate:function(e,r,t){return r>=1&&r<=4},set:function(e,r,t,n){return e.setUTCMonth((t-1)*3,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:{priority:110,parse:function(e,r,t,n){var a=function(i){return i-1};switch(r){case"M":return d(f.month,e,a);case"MM":return c(2,e,a);case"Mo":return t.ordinalNumber(e,{unit:"month",valueCallback:a});case"MMM":return t.month(e,{width:"abbreviated",context:"formatting"})||t.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return t.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(e,{width:"wide",context:"formatting"})||t.month(e,{width:"abbreviated",context:"formatting"})||t.month(e,{width:"narrow",context:"formatting"})}},validate:function(e,r,t){return r>=0&&r<=11},set:function(e,r,t,n){return e.setUTCMonth(t,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]},L:{priority:110,parse:function(e,r,t,n){var a=function(i){return i-1};switch(r){case"L":return d(f.month,e,a);case"LL":return c(2,e,a);case"Lo":return t.ordinalNumber(e,{unit:"month",valueCallback:a});case"LLL":return t.month(e,{width:"abbreviated",context:"standalone"})||t.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return t.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(e,{width:"wide",context:"standalone"})||t.month(e,{width:"abbreviated",context:"standalone"})||t.month(e,{width:"narrow",context:"standalone"})}},validate:function(e,r,t){return r>=0&&r<=11},set:function(e,r,t,n){return e.setUTCMonth(t,1),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:{priority:100,parse:function(e,r,t,n){switch(r){case"w":return d(f.week,e);case"wo":return t.ordinalNumber(e,{unit:"week"});default:return c(r.length,e)}},validate:function(e,r,t){return r>=1&&r<=53},set:function(e,r,t,n){return x(pt(e,t,n),n)},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:{priority:100,parse:function(e,r,t,n){switch(r){case"I":return d(f.week,e);case"Io":return t.ordinalNumber(e,{unit:"week"});default:return c(r.length,e)}},validate:function(e,r,t){return r>=1&&r<=53},set:function(e,r,t,n){return k(ht(e,t,n),n)},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:{priority:90,subPriority:1,parse:function(e,r,t,n){switch(r){case"d":return d(f.date,e);case"do":return t.ordinalNumber(e,{unit:"date"});default:return c(r.length,e)}},validate:function(e,r,t){var n=e.getUTCFullYear(),a=ie(n),i=e.getUTCMonth();return a?r>=1&&r<=Ct[i]:r>=1&&r<=gt[i]},set:function(e,r,t,n){return e.setUTCDate(t),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:{priority:90,subPriority:1,parse:function(e,r,t,n){switch(r){case"D":case"DD":return d(f.dayOfYear,e);case"Do":return t.ordinalNumber(e,{unit:"date"});default:return c(r.length,e)}},validate:function(e,r,t){var n=e.getUTCFullYear(),a=ie(n);return a?r>=1&&r<=366:r>=1&&r<=365},set:function(e,r,t,n){return e.setUTCMonth(0,t),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:{priority:90,parse:function(e,r,t,n){switch(r){case"E":case"EE":case"EEE":return t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return t.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return t.day(e,{width:"wide",context:"formatting"})||t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,r,t){return r>=0&&r<=6},set:function(e,r,t,n){return e=j(e,t,n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["D","i","e","c","t","T"]},e:{priority:90,parse:function(e,r,t,n){var a=function(i){var o=Math.floor((i-1)/7)*7;return(i+n.weekStartsOn+6)%7+o};switch(r){case"e":case"ee":return c(r.length,e,a);case"eo":return t.ordinalNumber(e,{unit:"day",valueCallback:a});case"eee":return t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"eeeee":return t.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return t.day(e,{width:"wide",context:"formatting"})||t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"})}},validate:function(e,r,t){return r>=0&&r<=6},set:function(e,r,t,n){return e=j(e,t,n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:{priority:90,parse:function(e,r,t,n){var a=function(i){var o=Math.floor((i-1)/7)*7;return(i+n.weekStartsOn+6)%7+o};switch(r){case"c":case"cc":return c(r.length,e,a);case"co":return t.ordinalNumber(e,{unit:"day",valueCallback:a});case"ccc":return t.day(e,{width:"abbreviated",context:"standalone"})||t.day(e,{width:"short",context:"standalone"})||t.day(e,{width:"narrow",context:"standalone"});case"ccccc":return t.day(e,{width:"narrow",context:"standalone"});case"cccccc":return t.day(e,{width:"short",context:"standalone"})||t.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return t.day(e,{width:"wide",context:"standalone"})||t.day(e,{width:"abbreviated",context:"standalone"})||t.day(e,{width:"short",context:"standalone"})||t.day(e,{width:"narrow",context:"standalone"})}},validate:function(e,r,t){return r>=0&&r<=6},set:function(e,r,t,n){return e=j(e,t,n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:{priority:90,parse:function(e,r,t,n){var a=function(i){return i===0?7:i};switch(r){case"i":case"ii":return c(r.length,e);case"io":return t.ordinalNumber(e,{unit:"day"});case"iii":return t.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||t.day(e,{width:"short",context:"formatting",valueCallback:a})||t.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiii":return t.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiiiii":return t.day(e,{width:"short",context:"formatting",valueCallback:a})||t.day(e,{width:"narrow",context:"formatting",valueCallback:a});case"iiii":default:return t.day(e,{width:"wide",context:"formatting",valueCallback:a})||t.day(e,{width:"abbreviated",context:"formatting",valueCallback:a})||t.day(e,{width:"short",context:"formatting",valueCallback:a})||t.day(e,{width:"narrow",context:"formatting",valueCallback:a})}},validate:function(e,r,t){return r>=1&&r<=7},set:function(e,r,t,n){return e=ut(e,t,n),e.setUTCHours(0,0,0,0),e},incompatibleTokens:["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]},a:{priority:80,parse:function(e,r,t,n){switch(r){case"a":case"aa":case"aaa":return t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return t.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(e,{width:"wide",context:"formatting"})||t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,r,t,n){return e.setUTCHours(G(t),0,0,0),e},incompatibleTokens:["b","B","H","k","t","T"]},b:{priority:80,parse:function(e,r,t,n){switch(r){case"b":case"bb":case"bbb":return t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return t.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(e,{width:"wide",context:"formatting"})||t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,r,t,n){return e.setUTCHours(G(t),0,0,0),e},incompatibleTokens:["a","B","H","k","t","T"]},B:{priority:80,parse:function(e,r,t,n){switch(r){case"B":case"BB":case"BBB":return t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return t.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(e,{width:"wide",context:"formatting"})||t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"})}},set:function(e,r,t,n){return e.setUTCHours(G(t),0,0,0),e},incompatibleTokens:["a","b","t","T"]},h:{priority:70,parse:function(e,r,t,n){switch(r){case"h":return d(f.hour12h,e);case"ho":return t.ordinalNumber(e,{unit:"hour"});default:return c(r.length,e)}},validate:function(e,r,t){return r>=1&&r<=12},set:function(e,r,t,n){var a=e.getUTCHours()>=12;return a&&t<12?e.setUTCHours(t+12,0,0,0):!a&&t===12?e.setUTCHours(0,0,0,0):e.setUTCHours(t,0,0,0),e},incompatibleTokens:["H","K","k","t","T"]},H:{priority:70,parse:function(e,r,t,n){switch(r){case"H":return d(f.hour23h,e);case"Ho":return t.ordinalNumber(e,{unit:"hour"});default:return c(r.length,e)}},validate:function(e,r,t){return r>=0&&r<=23},set:function(e,r,t,n){return e.setUTCHours(t,0,0,0),e},incompatibleTokens:["a","b","h","K","k","t","T"]},K:{priority:70,parse:function(e,r,t,n){switch(r){case"K":return d(f.hour11h,e);case"Ko":return t.ordinalNumber(e,{unit:"hour"});default:return c(r.length,e)}},validate:function(e,r,t){return r>=0&&r<=11},set:function(e,r,t,n){var a=e.getUTCHours()>=12;return a&&t<12?e.setUTCHours(t+12,0,0,0):e.setUTCHours(t,0,0,0),e},incompatibleTokens:["h","H","k","t","T"]},k:{priority:70,parse:function(e,r,t,n){switch(r){case"k":return d(f.hour24h,e);case"ko":return t.ordinalNumber(e,{unit:"hour"});default:return c(r.length,e)}},validate:function(e,r,t){return r>=1&&r<=24},set:function(e,r,t,n){var a=t<=24?t%24:t;return e.setUTCHours(a,0,0,0),e},incompatibleTokens:["a","b","h","H","K","t","T"]},m:{priority:60,parse:function(e,r,t,n){switch(r){case"m":return d(f.minute,e);case"mo":return t.ordinalNumber(e,{unit:"minute"});default:return c(r.length,e)}},validate:function(e,r,t){return r>=0&&r<=59},set:function(e,r,t,n){return e.setUTCMinutes(t,0,0),e},incompatibleTokens:["t","T"]},s:{priority:50,parse:function(e,r,t,n){switch(r){case"s":return d(f.second,e);case"so":return t.ordinalNumber(e,{unit:"second"});default:return c(r.length,e)}},validate:function(e,r,t){return r>=0&&r<=59},set:function(e,r,t,n){return e.setUTCSeconds(t,0),e},incompatibleTokens:["t","T"]},S:{priority:30,parse:function(e,r,t,n){var a=function(i){return Math.floor(i*Math.pow(10,-r.length+3))};return c(r.length,e,a)},set:function(e,r,t,n){return e.setUTCMilliseconds(t),e},incompatibleTokens:["t","T"]},X:{priority:10,parse:function(e,r,t,n){switch(r){case"X":return C(g.basicOptionalMinutes,e);case"XX":return C(g.basic,e);case"XXXX":return C(g.basicOptionalSeconds,e);case"XXXXX":return C(g.extendedOptionalSeconds,e);case"XXX":default:return C(g.extended,e)}},set:function(e,r,t,n){return r.timestampIsSet?e:new Date(e.getTime()-t)},incompatibleTokens:["t","T","x"]},x:{priority:10,parse:function(e,r,t,n){switch(r){case"x":return C(g.basicOptionalMinutes,e);case"xx":return C(g.basic,e);case"xxxx":return C(g.basicOptionalSeconds,e);case"xxxxx":return C(g.extendedOptionalSeconds,e);case"xxx":default:return C(g.extended,e)}},set:function(e,r,t,n){return r.timestampIsSet?e:new Date(e.getTime()-t)},incompatibleTokens:["t","T","X"]},t:{priority:40,parse:function(e,r,t,n){return ne(e)},set:function(e,r,t,n){return[new Date(t*1e3),{timestampIsSet:!0}]},incompatibleTokens:"*"},T:{priority:20,parse:function(e,r,t,n){return ne(e)},set:function(e,r,t,n){return[new Date(t),{timestampIsSet:!0}]},incompatibleTokens:"*"}},_t=Dt,xt=10,kt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Pt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Mt=/^'([^]*?)'?$/,Ut=/''/g,St=/\S/,Yt=/[a-zA-Z]/;function oe(e,r,t,n){l(3,arguments);var a=String(e),i=String(r),o=n||{},s=o.locale||Ve;if(!s.match)throw new RangeError("locale must contain match property");var u=s.options&&s.options.firstWeekContainsDate,h=u==null?1:m(u),b=o.firstWeekContainsDate==null?h:m(o.firstWeekContainsDate);if(!(b>=1&&b<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=s.options&&s.options.weekStartsOn,E=y==null?0:m(y),W=o.weekStartsOn==null?E:m(o.weekStartsOn);if(!(W>=0&&W<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(i==="")return a===""?w(t):new Date(NaN);var L={firstWeekContainsDate:b,weekStartsOn:W,locale:s},A=[{priority:xt,subPriority:-1,set:Ot,index:0}],D,de=i.match(Pt).map(function(p){var T=p[0];if(T==="p"||T==="P"){var F=rt[T];return F(p,s.formatLong,L)}return p}).join("").match(kt),N=[];for(D=0;D<de.length;D++){var v=de[D];!o.useAdditionalWeekYearTokens&&st(v)&&te(v,i,e),!o.useAdditionalDayOfYearTokens&&ot(v)&&te(v,i,e);var P=v[0],_=_t[P];if(_){var ce=_.incompatibleTokens;if(Array.isArray(ce)){for(var V=void 0,Q=0;Q<N.length;Q++){var le=N[Q].token;if(ce.indexOf(le)!==-1||le===P){V=N[Q];break}}if(V)throw new RangeError("The format string mustn't contain `".concat(V.fullToken,"` and `").concat(v,"` at the same time"))}else if(_.incompatibleTokens==="*"&&N.length)throw new RangeError("The format string mustn't contain `".concat(v,"` and any other token at the same time"));N.push({token:P,fullToken:v});var $=_.parse(a,v,s.match,L);if(!$)return new Date(NaN);A.push({priority:_.priority,subPriority:_.subPriority||0,set:_.set,validate:_.validate,value:$.value,index:A.length}),a=$.rest}else{if(P.match(Yt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+P+"`");if(v==="''"?v="'":P==="'"&&(v=Et(v)),a.indexOf(v)===0)a=a.slice(v.length);else return new Date(NaN)}}if(a.length>0&&St.test(a))return new Date(NaN);var fe=A.map(function(p){return p.priority}).sort(function(p,T){return T-p}).filter(function(p,T,F){return F.indexOf(p)===T}).map(function(p){return A.filter(function(T){return T.priority===p}).sort(function(T,F){return F.subPriority-T.subPriority})}).map(function(p){return p[0]}),K=w(t);if(isNaN(K))return new Date(NaN);var q=Ke(K,nt(K)),he={};for(D=0;D<fe.length;D++){var I=fe[D];if(I.validate&&!I.validate(q,I.value,L))return new Date(NaN);var B=I.set(q,he,I.value,L);B[0]?(q=B[0],Ze(he,B[1])):q=B}return q}function Ot(e,r){if(r.timestampIsSet)return e;var t=new Date(0);return t.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),t.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),t}function Et(e){return e.match(Mt)[1].replace(Ut,"'")}function se(e){return l(1,arguments),e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function z(e){if(l(1,arguments),!se(e)&&typeof e!="number")return!1;var r=w(e);return!isNaN(Number(r))}function Wt(e,r,t){return l(2,arguments),z(oe(e,r,new Date,t))}function R(e,r){l(2,arguments);var t=w(e),n=w(r);return t.getTime()>n.getTime()}function J(e,r){l(2,arguments);var t=w(e),n=w(r);return t.getTime()===n.getTime()}const ue=(e,r)=>r?oe(e,r,new Date):new Date(e),O=(e,r,t)=>{let n;return se(r)?n=r:typeof r=="string"&&(n=ue(r,t)),!z(n)||!z(e)?null:n},Nt=(e,r,t)=>{const n=O(r,e,t);return n===null?!1:J(n,r)},qt=(e,r,t)=>{const n=O(r,e,t);return n===null?!1:R(n,r)},It=(e,r,t)=>{const n=O(r,e,t);return n===null?!1:J(n,r)||R(n,r)},Ft=(e,r,t)=>{const n=O(r,e,t);return n===null?!1:R(r,n)},Ht=(e,r,t)=>{const n=O(r,e,t);return n===null?!1:J(n,r)||R(r,n)};return e=>(r,t)=>{const n=e(t),a={format:!0,isAfter:!0,isBefore:!0,required:!0,isBeforeOrEqual:!0,isAfterOrEqual:!0,isEqual:!0};if(typeof r!="string")return console.error("Value should be a string! The result will be always invalid"),!1;if(!n.required&&r==="")return!0;n.format!==void 0&&(typeof n.format!="string"?(console.error("Format field should be a string! The result will be always invalid"),a.format=!1):a.format=Wt(r,n.format));const i=ue(r,n.format);return n.isBefore!==void 0&&(a.isBefore=qt(n.isBefore,i,n.format)),n.isBeforeOrEqual!==void 0&&(a.isBeforeOrEqual=It(n.isBeforeOrEqual,i,n.format)),n.isAfter!==void 0&&(a.isAfter=Ft(n.isAfter,i,n.format)),n.isAfterOrEqual!==void 0&&(a.isAfter=Ht(n.isAfterOrEqual,i,n.format)),n.isEqual!==void 0&&(a.isEqual=Nt(n.isEqual,i,n.format)),Object.values(a).every(o=>o)}});