2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
|
function m(e,t){if(t.length<e)throw new TypeError(e+" argument"+(e>1?"s":"")+" required, but only "+t.length+" present")}function l(e){m(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[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 y(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}function g(e,t){m(2,arguments);var a=l(e),n=l(t),i=a.getTime()-n.getTime();return i<0?-1:i>0?1:i}function N(e,t){m(2,arguments);var a=l(e),n=l(t),i=a.getFullYear()-n.getFullYear(),r=a.getMonth()-n.getMonth();return i*12+r}function F(e,t){return m(2,arguments),l(e).getTime()-l(t).getTime()}var D={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}},x="trunc";function k(e){return e?D[e]:D[x]}function A(e){m(1,arguments);var t=l(e);return t.setHours(23,59,59,999),t}function C(e){m(1,arguments);var t=l(e),a=t.getMonth();return t.setFullYear(t.getFullYear(),a+1,0),t.setHours(23,59,59,999),t}function X(e){m(1,arguments);var t=l(e);return A(t).getTime()===C(t).getTime()}function I(e,t){m(2,arguments);var a=l(e),n=l(t),i=g(a,n),r=Math.abs(N(a,n)),o;if(r<1)o=0;else{a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-i*r);var s=g(a,n)===-i;X(l(e))&&r===1&&g(e,n)===1&&(s=!1),o=i*(r-Number(s))}return o===0?0:o}function O(e,t,a){m(2,arguments);var n=F(e,t)/1e3;return k(a==null?void 0:a.roundingMethod)(n)}var j={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"}},E=function(e,t,a){var n,i=j[e];return typeof i=="string"?n=i:t===1?n=i.one:n=i.other.replace("{{count}}",t.toString()),a!=null&&a.addSuffix?a.comparison&&a.comparison>0?"in "+n:n+" ago":n},R=E;function M(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},a=t.width?String(t.width):e.defaultWidth,n=e.formats[a]||e.formats[e.defaultWidth];return n}}var Y={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},_={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},z={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},L={date:M({formats:Y,defaultWidth:"full"}),time:M({formats:_,defaultWidth:"full"}),dateTime:M({formats:z,defaultWidth:"full"})},V=L,q={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},H=function(e,t,a,n){return q[e]},J=H;function c(e){return function(t,a){var n=a||{},i=n.context?String(n.context):"standalone",r;if(i==="formatting"&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,s=n.width?String(n.width):o;r=e.formattingValues[s]||e.formattingValues[o]}else{var d=e.defaultWidth,h=n.width?String
|