date-fns
Version:
Modern JavaScript date utility library
1 lines • 9.55 kB
JavaScript
(()=>{function e(t){"@babel/helpers - typeof";return e=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e(t)}function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function n(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]==null?{}:arguments[n];n%2?t(Object(i),!0).forEach(function(t){r(e,t,i[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function r(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(t){var n=a(t,`string`);return e(n)==`symbol`?n:n+``}function a(t,n){if(e(t)!=`object`||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var i=r.call(t,n||`default`);if(e(i)!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(t)}var o={lessThanXSeconds:{one:`1びょうみまん`,other:`{{count}}びょうみまん`,oneWithSuffix:`やく1びょう`,otherWithSuffix:`やく{{count}}びょう`},xSeconds:{one:`1びょう`,other:`{{count}}びょう`},halfAMinute:`30びょう`,lessThanXMinutes:{one:`1ぷんみまん`,other:`{{count}}ふんみまん`,oneWithSuffix:`やく1ぷん`,otherWithSuffix:`やく{{count}}ふん`},xMinutes:{one:`1ぷん`,other:`{{count}}ふん`},aboutXHours:{one:`やく1じかん`,other:`やく{{count}}じかん`},xHours:{one:`1じかん`,other:`{{count}}じかん`},xDays:{one:`1にち`,other:`{{count}}にち`},aboutXWeeks:{one:`やく1しゅうかん`,other:`やく{{count}}しゅうかん`},xWeeks:{one:`1しゅうかん`,other:`{{count}}しゅうかん`},aboutXMonths:{one:`やく1かげつ`,other:`やく{{count}}かげつ`},xMonths:{one:`1かげつ`,other:`{{count}}かげつ`},aboutXYears:{one:`やく1ねん`,other:`やく{{count}}ねん`},xYears:{one:`1ねん`,other:`{{count}}ねん`},overXYears:{one:`1ねんいじょう`,other:`{{count}}ねんいじょう`},almostXYears:{one:`1ねんちかく`,other:`{{count}}ねんちかく`}},s=function(e,t,n){n||={};var r,i=o[e];return r=typeof i==`string`?i:t===1?n.addSuffix&&i.oneWithSuffix?i.oneWithSuffix:i.one:n.addSuffix&&i.otherWithSuffix?i.otherWithSuffix.replace(`{{count}}`,String(t)):i.other.replace(`{{count}}`,String(t)),n.addSuffix?n.comparison&&n.comparison>0?r+`あと`:r+`まえ`:r};function c(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var l={date:c({formats:{full:`yねんMがつdにちEEEE`,long:`yねんMがつdにち`,medium:`y/MM/dd`,short:`y/MM/dd`},defaultWidth:`full`}),time:c({formats:{full:`Hじmmふんssびょう zzzz`,long:`H:mm:ss z`,medium:`H:mm:ss`,short:`H:mm`},defaultWidth:`full`}),dateTime:c({formats:{full:`{{date}} {{time}}`,long:`{{date}} {{time}}`,medium:`{{date}} {{time}}`,short:`{{date}} {{time}}`},defaultWidth:`full`})},u={lastWeek:`せんしゅうのeeeeのp`,yesterday:`きのうのp`,today:`きょうのp`,tomorrow:`あしたのp`,nextWeek:`よくしゅうのeeeeのp`,other:`P`},d=function(e,t,n,r){return u[e]};function f(e){return function(t,n){var r=n!=null&&n.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,o=n!=null&&n.width?String(n.width):a;i=e.formattingValues[o]||e.formattingValues[a]}else{var s=e.defaultWidth,c=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[c]||e.values[s]}var l=e.argumentCallback?e.argumentCallback(t):t;return i[l]}}var p={ordinalNumber:function(e,t){var n=Number(e);switch(String(t?.unit)){case`year`:return`${n}ねん`;case`quarter`:return`だい${n}しはんき`;case`month`:return`${n}がつ`;case`week`:return`だい${n}しゅう`;case`date`:return`${n}にち`;case`hour`:return`${n}じ`;case`minute`:return`${n}ふん`;case`second`:return`${n}びょう`;default:return`${n}`}},era:f({values:{narrow:[`BC`,`AC`],abbreviated:[`きげんぜん`,`せいれき`],wide:[`きげんぜん`,`せいれき`]},defaultWidth:`wide`}),quarter:f({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`だい1しはんき`,`だい2しはんき`,`だい3しはんき`,`だい4しはんき`]},defaultWidth:`wide`,argumentCallback:function(e){return Number(e)-1}}),month:f({values:{narrow:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`],abbreviated:[`1がつ`,`2がつ`,`3がつ`,`4がつ`,`5がつ`,`6がつ`,`7がつ`,`8がつ`,`9がつ`,`10がつ`,`11がつ`,`12がつ`],wide:[`1がつ`,`2がつ`,`3がつ`,`4がつ`,`5がつ`,`6がつ`,`7がつ`,`8がつ`,`9がつ`,`10がつ`,`11がつ`,`12がつ`]},defaultWidth:`wide`}),day:f({values:{narrow:[`にち`,`げつ`,`か`,`すい`,`もく`,`きん`,`ど`],short:[`にち`,`げつ`,`か`,`すい`,`もく`,`きん`,`ど`],abbreviated:[`にち`,`げつ`,`か`,`すい`,`もく`,`きん`,`ど`],wide:[`にちようび`,`げつようび`,`かようび`,`すいようび`,`もくようび`,`きんようび`,`どようび`]},defaultWidth:`wide`}),dayPeriod:f({values:{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:`しんや`}},defaultWidth:`wide`,formattingValues:{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:`しんや`}},defaultFormattingWidth:`wide`})};function m(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;var o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?g(s,function(e){return e.test(o)}):h(s,function(e){return e.test(o)}),l=e.valueCallback?e.valueCallback(c):c;l=n.valueCallback?n.valueCallback(l):l;var u=t.slice(o.length);return{value:l,rest:u}}}function h(e,t){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function g(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return n}function _(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var i=r[0],a=t.match(e.parsePattern);if(!a)return null;var o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;var s=t.slice(i.length);return{value:o,rest:s}}}var v={code:`ja-Hira`,formatDistance:s,formatLong:l,formatRelative:d,localize:p,match:{ordinalNumber:_({matchPattern:/^だ?い?\d+(ねん|しはんき|がつ|しゅう|にち|じ|ふん|びょう)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:m({matchPatterns:{narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(きげん[前後]|せいれき)/i,wide:/^(きげん[前後]|せいれき)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^B/i,/^A/i],any:[/^(きげんぜん)/i,/^(せいれき|きげんご)/i]},defaultParseWidth:`any`}),quarter:m({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^だい[1234一二三四1234]しはんき/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},defaultParseWidth:`any`,valueCallback:function(e){return e+1}}),month:m({matchPatterns:{narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])がつ/i,wide:/^([123456789]|1[012])がつ/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},defaultParseWidth:`any`}),day:m({matchPatterns:{narrow:/^(にち|げつ|か|すい|もく|きん|ど)/,short:/^(にち|げつ|か|すい|もく|きん|ど)/,abbreviated:/^(にち|げつ|か|すい|もく|きん|ど)/,wide:/^(にち|げつ|か|すい|もく|きん|ど)ようび/},defaultMatchWidth:`wide`,parsePatterns:{any:[/^にち/,/^げつ/,/^か/,/^すい/,/^もく/,/^きん/,/^ど/]},defaultParseWidth:`any`}),dayPeriod:m({matchPatterns:{any:/^(AM|PM|ごぜん|ごご|しょうご|しんや|まよなか|よる|あさ)/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^(A|ごぜん)/i,pm:/^(P|ごご)/i,midnight:/^しんや|まよなか/i,noon:/^しょうご/i,morning:/^あさ/i,afternoon:/^ごご/i,evening:/^よる/i,night:/^しんや/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};window.dateFns=n(n({},window.dateFns),{},{locale:n(n({},window.dateFns?.locale),{},{jaHira:v})}),console.log(`date-fns CDN files have moved to @date-fns/cdn. Please update your URLs. See: https://date-fns.org/docs/CDN`)})();