date-fns
Version:
Modern JavaScript date utility library
5 lines (3 loc) • 18.7 kB
JavaScript
(()=>{var R;function $(B,C){var G=Object.keys(B);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(B);C&&(J=J.filter(function(X){return Object.getOwnPropertyDescriptor(B,X).enumerable})),G.push.apply(G,J)}return G}function j(B){for(var C=1;C<arguments.length;C++){var G=arguments[C]!=null?arguments[C]:{};C%2?$(Object(G),!0).forEach(function(J){D(B,J,G[J])}):Object.getOwnPropertyDescriptors?Object.defineProperties(B,Object.getOwnPropertyDescriptors(G)):$(Object(G)).forEach(function(J){Object.defineProperty(B,J,Object.getOwnPropertyDescriptor(G,J))})}return B}function D(B,C,G){return(C=F(C))in B?Object.defineProperty(B,C,{value:G,enumerable:!0,configurable:!0,writable:!0}):B[C]=G,B}function F(B){var C=b(B,"string");return K(C)=="symbol"?C:C+""}function b(B,C){if(K(B)!="object"||!B)return B;var G=B[Symbol.toPrimitive];if(G!==void 0){var J=G.call(B,C||"default");if(K(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return(C==="string"?String:Number)(B)}function k(B,C){return g(B)||_(B,C)||h(B,C)||f()}function f(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function h(B,C){if(B){if(typeof B=="string")return W(B,C);var G={}.toString.call(B).slice(8,-1);return G==="Object"&&B.constructor&&(G=B.constructor.name),G==="Map"||G==="Set"?Array.from(B):G==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(G)?W(B,C):void 0}}function W(B,C){(C==null||C>B.length)&&(C=B.length);for(var G=0,J=Array(C);G<C;G++)J[G]=B[G];return J}function _(B,C){var G=B==null?null:typeof Symbol<"u"&&B[Symbol.iterator]||B["@@iterator"];if(G!=null){var J,X,Z,U,H=[],q=!0,Y=!1;try{if(Z=(G=G.call(B)).next,C===0){if(Object(G)!==G)return;q=!1}else for(;!(q=(J=Z.call(G)).done)&&(H.push(J.value),H.length!==C);q=!0);}catch(E){Y=!0,X=E}finally{try{if(!q&&G.return!=null&&(U=G.return(),Object(U)!==U))return}finally{if(Y)throw X}}return H}}function g(B){if(Array.isArray(B))return B}function K(B){return K=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(C){return typeof C}:function(C){return C&&typeof Symbol=="function"&&C.constructor===Symbol&&C!==Symbol.prototype?"symbol":typeof C},K(B)}var y=Object.defineProperty,m=function(C){return C};function c(B,C){this[B]=m.bind(null,C)}var fB=function(C,G){for(var J in G)y(C,J,{get:G[J],enumerable:!0,configurable:!0,set:c.bind(G,J)})};function A(B,C){if(B.one!==void 0&&C===1)return B.one;var G=C%10,J=C%100;if(G===1&&J!==11)return B.singularNominative.replace("{{count}}",String(C));else if(G>=2&&G<=4&&(J<10||J>20))return B.singularGenitive.replace("{{count}}",String(C));else return B.pluralGenitive.replace("{{count}}",String(C))}function Q(B){return function(C,G){if(G&&G.addSuffix)if(G.comparison&&G.comparison>0)if(B.future)return A(B.future,C);else return"праз "+A(B.regular,C);else if(B.past)return A(B.past,C);else return A(B.regular,C)+" таму";else return A(B.regular,C)}}var p=function(C,G){if(G&&G.addSuffix)if(G.comparison&&G.comparison>0)return"праз паўхвіліны";else return"паўхвіліны таму";return"паўхвіліны"},u={lessThanXSeconds:Q({regular:{one:"менш за секунду",singularNominative:"менш за {{count}} секунду",singularGenitive:"менш за {{count}} секунды",pluralGenitive:"менш за {{count}} секунд"},future:{one:"менш, чым праз секунду",singularNominative:"менш, чым праз {{count}} секунду",singularGenitive:"менш, чым праз {{count}} секунды",pluralGenitive:"менш, чым праз {{count}} секунд"}}),xSeconds:Q({regular:{singularNominative:"{{count}} секунда",singularGenitive:"{{count}} секунды",pluralGenitive:"{{count}} секунд"},past:{singularNominative:"{{count}} секунду таму",singularGenitive:"{{count}} секунды таму",pluralGenitive:"{{count}} секунд таму"},future:{singularNominative:"праз {{count}} секунду",singularGenitive:"праз {{count}} секунды",pluralGenitive:"праз {{count}} секунд"}}),halfAMinute:p,lessThanXMinutes:Q({regular:{one:"менш за хвіліну",singularNominative:"менш за {{count}} хвіліну",singularGenitive:"менш за {{count}} хвіліны",pluralGenitive:"менш за {{count}} хвілін"},future:{one:"менш, чым праз хвіліну",singularNominative:"менш, чым праз {{count}} хвіліну",singularGenitive:"менш, чым праз {{count}} хвіліны",pluralGenitive:"менш, чым праз {{count}} хвілін"}}),xMinutes:Q({regular:{singularNominative:"{{count}} хвіліна",singularGenitive:"{{count}} хвіліны",pluralGenitive:"{{count}} хвілін"},past:{singularNominative:"{{count}} хвіліну таму",singularGenitive:"{{count}} хвіліны таму",pluralGenitive:"{{count}} хвілін таму"},future:{singularNominative:"праз {{count}} хвіліну",singularGenitive:"праз {{count}} хвіліны",pluralGenitive:"праз {{count}} хвілін"}}),aboutXHours:Q({regular:{singularNominative:"каля {{count}} гадзіны",singularGenitive:"каля {{count}} гадзін",pluralGenitive:"каля {{count}} гадзін"},future:{singularNominative:"прыблізна праз {{count}} гадзіну",singularGenitive:"прыблізна праз {{count}} гадзіны",pluralGenitive:"прыблізна праз {{count}} гадзін"}}),xHours:Q({regular:{singularNominative:"{{count}} гадзіна",singularGenitive:"{{count}} гадзіны",pluralGenitive:"{{count}} гадзін"},past:{singularNominative:"{{count}} гадзіну таму",singularGenitive:"{{count}} гадзіны таму",pluralGenitive:"{{count}} гадзін таму"},future:{singularNominative:"праз {{count}} гадзіну",singularGenitive:"праз {{count}} гадзіны",pluralGenitive:"праз {{count}} гадзін"}}),xDays:Q({regular:{singularNominative:"{{count}} дзень",singularGenitive:"{{count}} дні",pluralGenitive:"{{count}} дзён"}}),aboutXWeeks:Q({regular:{singularNominative:"каля {{count}} тыдні",singularGenitive:"каля {{count}} тыдняў",pluralGenitive:"каля {{count}} тыдняў"},future:{singularNominative:"прыблізна праз {{count}} тыдзень",singularGenitive:"прыблізна праз {{count}} тыдні",pluralGenitive:"прыблізна праз {{count}} тыдняў"}}),xWeeks:Q({regular:{singularNominative:"{{count}} тыдзень",singularGenitive:"{{count}} тыдні",pluralGenitive:"{{count}} тыдняў"}}),aboutXMonths:Q({regular:{singularNominative:"каля {{count}} месяца",singularGenitive:"каля {{count}} месяцаў",pluralGenitive:"каля {{count}} месяцаў"},future:{singularNominative:"прыблізна праз {{count}} месяц",singularGenitive:"прыблізна праз {{count}} месяцы",pluralGenitive:"прыблізна праз {{count}} месяцаў"}}),xMonths:Q({regular:{singularNominative:"{{count}} месяц",singularGenitive:"{{count}} месяцы",pluralGenitive:"{{count}} месяцаў"}}),aboutXYears:Q({regular:{singularNominative:"каля {{count}} года",singularGenitive:"каля {{count}} гадоў",pluralGenitive:"каля {{count}} гадоў"},future:{singularNominative:"прыблізна праз {{count}} год",singularGenitive:"прыблізна праз {{count}} гады",pluralGenitive:"прыблізна праз {{count}} гадоў"}}),xYears:Q({regular:{singularNominative:"{{count}} год",singularGenitive:"{{count}} гады",pluralGenitive:"{{count}} гадоў"}}),overXYears:Q({regular:{singularNominative:"больш за {{count}} год",singularGenitive:"больш за {{count}} гады",pluralGenitive:"больш за {{count}} гадоў"},future:{singularNominative:"больш, чым праз {{count}} год",singularGenitive:"больш, чым праз {{count}} гады",pluralGenitive:"больш, чым праз {{count}} гадоў"}}),almostXYears:Q({regular:{singularNominative:"амаль {{count}} год",singularGenitive:"амаль {{count}} гады",pluralGenitive:"амаль {{count}} гадоў"},future:{singularNominative:"амаль праз {{count}} год",singularGenitive:"амаль праз {{count}} гады",pluralGenitive:"амаль праз {{count}} гадоў"}})},d=function(C,G,J){return J=J||{},u[C](G,J)};function M(B){return function(){var C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},G=C.width?String(C.width):B.defaultWidth,J=B.formats[G]||B.formats[B.defaultWidth];return J}}var l={full:"EEEE, d MMMM y 'г.'",long:"d MMMM y 'г.'",medium:"d MMM y 'г.'",short:"dd.MM.y"},i={full:"H:mm:ss zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},s={any:"{{date}}, {{time}}"},r={date:M({formats:l,defaultWidth:"full"}),time:M({formats:i,defaultWidth:"full"}),dateTime:M({formats:s,defaultWidth:"any"})},hB=7,n=365.2425,o=Math.pow(10,8)*24*60*60*1000,_B=-o,gB=604800000,yB=86400000,mB=60000,cB=3600000,pB=1000,uB=525600,dB=43200,lB=1440,iB=60,sB=3,rB=12,nB=4,a=3600,oB=60,O=a*24,aB=O*7,t=O*n,e=t/12,tB=e*3,T=Symbol.for("constructDateFrom");function P(B,C){if(typeof B==="function")return B(C);if(B&&K(B)==="object"&&T in B)return B[T](C);if(B instanceof Date)return new B.constructor(C);return new Date(C)}function BB(B){for(var C=arguments.length,G=Array(C>1?C-1:0),J=1;J<C;J++)G[J-1]=arguments[J];var X=P.bind(null,B||G.find(function(Z){return K(Z)==="object"}));return G.map(X)}var z={};function CB(){return z}function eB(B){z=B}function x(B,C){return P(C||B,B)}function L(B,C){var G,J,X,Z,U,H,q=CB(),Y=(G=(J=(X=(Z=C===null||C===void 0?void 0:C.weekStartsOn)!==null&&Z!==void 0?Z:C===null||C===void 0||(U=C.locale)===null||U===void 0||(U=U.options)===null||U===void 0?void 0:U.weekStartsOn)!==null&&X!==void 0?X:q.weekStartsOn)!==null&&J!==void 0?J:(H=q.locale)===null||H===void 0||(H=H.options)===null||H===void 0?void 0:H.weekStartsOn)!==null&&G!==void 0?G:0,E=x(B,C===null||C===void 0?void 0:C.in),N=E.getDay(),kB=(N<Y?7:0)+N-Y;return E.setDate(E.getDate()-kB),E.setHours(0,0,0,0),E}function w(B,C,G){var J=BB(G===null||G===void 0?void 0:G.in,B,C),X=k(J,2),Z=X[0],U=X[1];return+L(Z,G)===+L(U,G)}var S=["нядзелю","панядзелак","аўторак","сераду","чацвер","пятніцу","суботу"];function GB(B){var C=S[B];switch(B){case 0:case 3:case 5:case 6:return"'у мінулую "+C+" а' p";case 1:case 2:case 4:return"'у мінулы "+C+" а' p"}}function v(B){var C=S[B];return"'у "+C+" а' p"}function JB(B){var C=S[B];switch(B){case 0:case 3:case 5:case 6:return"'у наступную "+C+" а' p";case 1:case 2:case 4:return"'у наступны "+C+" а' p"}}var XB=function(C,G,J){var X=x(C),Z=X.getDay();if(w(X,G,J))return v(Z);else return GB(Z)},ZB=function(C,G,J){var X=x(C),Z=X.getDay();if(w(X,G,J))return v(Z);else return JB(Z)},UB={lastWeek:XB,yesterday:"'учора а' p",today:"'сёння а' p",tomorrow:"'заўтра а' p",nextWeek:ZB,other:"P"},HB=function(C,G,J,X){var Z=UB[C];if(typeof Z==="function")return Z(G,J,X);return Z};function I(B){return function(C,G){var J=G!==null&&G!==void 0&&G.context?String(G.context):"standalone",X;if(J==="formatting"&&B.formattingValues){var Z=B.defaultFormattingWidth||B.defaultWidth,U=G!==null&&G!==void 0&&G.width?String(G.width):Z;X=B.formattingValues[U]||B.formattingValues[Z]}else{var H=B.defaultWidth,q=G!==null&&G!==void 0&&G.width?String(G.width):B.defaultWidth;X=B.values[q]||B.values[H]}var Y=B.argumentCallback?B.argumentCallback(C):C;return X[Y]}}var QB={narrow:["да н.э.","н.э."],abbreviated:["да н. э.","н. э."],wide:["да нашай эры","нашай эры"]},YB={narrow:["1","2","3","4"],abbreviated:["1-ы кв.","2-і кв.","3-і кв.","4-ы кв."],wide:["1-ы квартал","2-і квартал","3-і квартал","4-ы квартал"]},qB={narrow:["С","Л","С","К","М","Ч","Л","Ж","В","К","Л","С"],abbreviated:["студз.","лют.","сак.","крас.","май","чэрв.","ліп.","жн.","вер.","кастр.","ліст.","снеж."],wide:["студзень","люты","сакавік","красавік","май","чэрвень","ліпень","жнівень","верасень","кастрычнік","лістапад","снежань"]},EB={narrow:["С","Л","С","К","М","Ч","Л","Ж","В","К","Л","С"],abbreviated:["студз.","лют.","сак.","крас.","мая","чэрв.","ліп.","жн.","вер.","кастр.","ліст.","снеж."],wide:["студзеня","лютага","сакавіка","красавіка","мая","чэрвеня","ліпеня","жніўня","верасня","кастрычніка","лістапада","снежня"]},KB={narrow:["Н","П","А","С","Ч","П","С"],short:["нд","пн","аў","ср","чц","пт","сб"],abbreviated:["нядз","пан","аўт","сер","чац","пят","суб"],wide:["нядзеля","панядзелак","аўторак","серада","чацвер","пятніца","субота"]},NB={narrow:{am:"ДП",pm:"ПП",midnight:"поўн.",noon:"поўд.",morning:"ран.",afternoon:"дзень",evening:"веч.",night:"ноч"},abbreviated:{am:"ДП",pm:"ПП",midnight:"поўн.",noon:"поўд.",morning:"ран.",afternoon:"дзень",evening:"веч.",night:"ноч"},wide:{am:"ДП",pm:"ПП",midnight:"поўнач",noon:"поўдзень",morning:"раніца",afternoon:"дзень",evening:"вечар",night:"ноч"}},AB={narrow:{am:"ДП",pm:"ПП",midnight:"поўн.",noon:"поўд.",morning:"ран.",afternoon:"дня",evening:"веч.",night:"ночы"},abbreviated:{am:"ДП",pm:"ПП",midnight:"поўн.",noon:"поўд.",morning:"ран.",afternoon:"дня",evening:"веч.",night:"ночы"},wide:{am:"ДП",pm:"ПП",midnight:"поўнач",noon:"поўдзень",morning:"раніцы",afternoon:"дня",evening:"вечара",night:"ночы"}},IB=function(C,G){var J=String(G===null||G===void 0?void 0:G.unit),X=Number(C),Z;if(J==="date")Z="-га";else if(J==="hour"||J==="minute"||J==="second")Z="-я";else Z=(X%10===2||X%10===3)&&X%100!==12&&X%100!==13?"-і":"-ы";return X+Z},VB={ordinalNumber:IB,era:I({values:QB,defaultWidth:"wide"}),quarter:I({values:YB,defaultWidth:"wide",argumentCallback:function(C){return C-1}}),month:I({values:qB,defaultWidth:"wide",formattingValues:EB,defaultFormattingWidth:"wide"}),day:I({values:KB,defaultWidth:"wide"}),dayPeriod:I({values:NB,defaultWidth:"any",formattingValues:AB,defaultFormattingWidth:"wide"})};function V(B){return function(C){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},J=G.width,X=J&&B.matchPatterns[J]||B.matchPatterns[B.defaultMatchWidth],Z=C.match(X);if(!Z)return null;var U=Z[0],H=J&&B.parsePatterns[J]||B.parsePatterns[B.defaultParseWidth],q=Array.isArray(H)?RB(H,function(N){return N.test(U)}):jB(H,function(N){return N.test(U)}),Y;Y=B.valueCallback?B.valueCallback(q):q,Y=G.valueCallback?G.valueCallback(Y):Y;var E=C.slice(U.length);return{value:Y,rest:E}}}function jB(B,C){for(var G in B)if(Object.prototype.hasOwnProperty.call(B,G)&&C(B[G]))return G;return}function RB(B,C){for(var G=0;G<B.length;G++)if(C(B[G]))return G;return}function MB(B){return function(C){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},J=C.match(B.matchPattern);if(!J)return null;var X=J[0],Z=C.match(B.parsePattern);if(!Z)return null;var U=B.valueCallback?B.valueCallback(Z[0]):Z[0];U=G.valueCallback?G.valueCallback(U):U;var H=C.slice(X.length);return{value:U,rest:H}}}var xB=/^(\d+)(-?(е|я|га|і|ы|ае|ая|яя|шы|гі|ці|ты|мы))?/i,SB=/\d+/i,$B={narrow:/^((да )?н\.?\s?э\.?)/i,abbreviated:/^((да )?н\.?\s?э\.?)/i,wide:/^(да нашай эры|нашай эры|наша эра)/i},WB={any:[/^д/i,/^н/i]},OB={narrow:/^[1234]/i,abbreviated:/^[1234](-?[ыі]?)? кв.?/i,wide:/^[1234](-?[ыі]?)? квартал/i},TB={any:[/1/i,/2/i,/3/i,/4/i]},PB={narrow:/^[слкмчжв]/i,abbreviated:/^(студз|лют|сак|крас|ма[йя]|чэрв|ліп|жн|вер|кастр|ліст|снеж)\.?/i,wide:/^(студзен[ья]|лют(ы|ага)|сакавіка?|красавіка?|ма[йя]|чэрвен[ья]|ліпен[ья]|жні(вень|ўня)|верас(ень|ня)|кастрычніка?|лістапада?|снеж(ань|ня))/i},zB={narrow:[/^с/i,/^л/i,/^с/i,/^к/i,/^м/i,/^ч/i,/^л/i,/^ж/i,/^в/i,/^к/i,/^л/i,/^с/i],any:[/^ст/i,/^лю/i,/^са/i,/^кр/i,/^ма/i,/^ч/i,/^ліп/i,/^ж/i,/^в/i,/^ка/i,/^ліс/i,/^сн/i]},LB={narrow:/^[нпасч]/i,short:/^(нд|ня|пн|па|аў|ат|ср|се|чц|ча|пт|пя|сб|су)\.?/i,abbreviated:/^(нядз?|ндз|пнд|пан|аўт|срд|сер|чцв|чац|птн|пят|суб).?/i,wide:/^(нядзел[яі]|панядзел(ак|ка)|аўтор(ак|ка)|серад[аы]|чацв(ер|ярга)|пятніц[аы]|субот[аы])/i},wB={narrow:[/^н/i,/^п/i,/^а/i,/^с/i,/^ч/i,/^п/i,/^с/i],any:[/^н/i,/^п[ан]/i,/^а/i,/^с[ер]/i,/^ч/i,/^п[ят]/i,/^с[уб]/i]},vB={narrow:/^([дп]п|поўн\.?|поўд\.?|ран\.?|дзень|дня|веч\.?|ночы?)/i,abbreviated:/^([дп]п|поўн\.?|поўд\.?|ран\.?|дзень|дня|веч\.?|ночы?)/i,wide:/^([дп]п|поўнач|поўдзень|раніц[аы]|дзень|дня|вечара?|ночы?)/i},DB={any:{am:/^дп/i,pm:/^пп/i,midnight:/^поўн/i,noon:/^поўд/i,morning:/^р/i,afternoon:/^д[зн]/i,evening:/^в/i,night:/^н/i}},FB={ordinalNumber:MB({matchPattern:xB,parsePattern:SB,valueCallback:function(C){return parseInt(C,10)}}),era:V({matchPatterns:$B,defaultMatchWidth:"wide",parsePatterns:WB,defaultParseWidth:"any"}),quarter:V({matchPatterns:OB,defaultMatchWidth:"wide",parsePatterns:TB,defaultParseWidth:"any",valueCallback:function(C){return C+1}}),month:V({matchPatterns:PB,defaultMatchWidth:"wide",parsePatterns:zB,defaultParseWidth:"any"}),day:V({matchPatterns:LB,defaultMatchWidth:"wide",parsePatterns:wB,defaultParseWidth:"any"}),dayPeriod:V({matchPatterns:vB,defaultMatchWidth:"wide",parsePatterns:DB,defaultParseWidth:"any"})},bB={code:"be",formatDistance:d,formatLong:r,formatRelative:HB,localize:VB,match:FB,options:{weekStartsOn:1,firstWeekContainsDate:1}};window.dateFns=j(j({},window.dateFns),{},{locale:j(j({},(R=window.dateFns)===null||R===void 0?void 0:R.locale),{},{be:bB})})})();
//# debugId=8C1A3295E696E63D64756E2164756E21