UNPKG

date-fns

Version:

Modern JavaScript date utility library

1,069 lines (1,008 loc) 30.5 kB
(() => { var _window$dateFns;function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {_defineProperty(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;}function _defineProperty(e, r, t) {return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e;}function _toPropertyKey(t) {var i = _toPrimitive(t, "string");return "symbol" == _typeof(i) ? i : i + "";}function _toPrimitive(t, r) {if ("object" != _typeof(t) || !t) return t;var e = t[Symbol.toPrimitive];if (void 0 !== e) {var i = e.call(t, r || "default");if ("object" != _typeof(i)) return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return ("string" === r ? String : Number)(t);}function _slicedToArray(r, e) {return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r, a) {if (r) {if ("string" == typeof r) return _arrayLikeToArray(r, a);var t = {}.toString.call(r).slice(8, -1);return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;}}function _arrayLikeToArray(r, a) {(null == a || a > r.length) && (a = r.length);for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];return n;}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(r) {if (Array.isArray(r)) return r;}function _typeof(o) {"@babel/helpers - typeof";return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;}, _typeof(o);} //#region dist/date-fns/locale/lv/_lib/formatDistance.js function buildLocalizeTokenFn(schema) { return function (count, options) { if (count === 1) {if (options !== null && options !== void 0 && options.addSuffix) return schema.one[0].replace("{{time}}", schema.one[2]);else return schema.one[0].replace("{{time}}", schema.one[1]);} else { var rem = count % 10 === 1 && count % 100 !== 11; if (options !== null && options !== void 0 && options.addSuffix) return schema.other[0].replace("{{time}}", rem ? schema.other[3] : schema.other[4]).replace("{{count}}", String(count));else return schema.other[0].replace("{{time}}", rem ? schema.other[1] : schema.other[2]).replace("{{count}}", String(count)); } }; } var formatDistanceLocale = { lessThanXSeconds: buildLocalizeTokenFn({ one: [ "mazāk par {{time}}", "sekundi", "sekundi"], other: [ "mazāk nekā {{count}} {{time}}", "sekunde", "sekundes", "sekundes", "sekundēm"] }), xSeconds: buildLocalizeTokenFn({ one: [ "1 {{time}}", "sekunde", "sekundes"], other: [ "{{count}} {{time}}", "sekunde", "sekundes", "sekundes", "sekundēm"] }), halfAMinute: function halfAMinute(_count, options) { if (options !== null && options !== void 0 && options.addSuffix) return "pusminūtes";else return "pusminūte"; }, lessThanXMinutes: buildLocalizeTokenFn({ one: [ "mazāk par {{time}}", "minūti", "minūti"], other: [ "mazāk nekā {{count}} {{time}}", "minūte", "minūtes", "minūtes", "minūtēm"] }), xMinutes: buildLocalizeTokenFn({ one: [ "1 {{time}}", "minūte", "minūtes"], other: [ "{{count}} {{time}}", "minūte", "minūtes", "minūtes", "minūtēm"] }), aboutXHours: buildLocalizeTokenFn({ one: [ "apmēram 1 {{time}}", "stunda", "stundas"], other: [ "apmēram {{count}} {{time}}", "stunda", "stundas", "stundas", "stundām"] }), xHours: buildLocalizeTokenFn({ one: [ "1 {{time}}", "stunda", "stundas"], other: [ "{{count}} {{time}}", "stunda", "stundas", "stundas", "stundām"] }), xDays: buildLocalizeTokenFn({ one: [ "1 {{time}}", "diena", "dienas"], other: [ "{{count}} {{time}}", "diena", "dienas", "dienas", "dienām"] }), aboutXWeeks: buildLocalizeTokenFn({ one: [ "apmēram 1 {{time}}", "nedēļa", "nedēļas"], other: [ "apmēram {{count}} {{time}}", "nedēļa", "nedēļu", "nedēļas", "nedēļām"] }), xWeeks: buildLocalizeTokenFn({ one: [ "1 {{time}}", "nedēļa", "nedēļas"], other: [ "{{count}} {{time}}", "nedēļa", "nedēļu", "nedēļas", "nedēļām"] }), aboutXMonths: buildLocalizeTokenFn({ one: [ "apmēram 1 {{time}}", "mēnesis", "mēneša"], other: [ "apmēram {{count}} {{time}}", "mēnesis", "mēneši", "mēneša", "mēnešiem"] }), xMonths: buildLocalizeTokenFn({ one: [ "1 {{time}}", "mēnesis", "mēneša"], other: [ "{{count}} {{time}}", "mēnesis", "mēneši", "mēneša", "mēnešiem"] }), aboutXYears: buildLocalizeTokenFn({ one: [ "apmēram 1 {{time}}", "gads", "gada"], other: [ "apmēram {{count}} {{time}}", "gads", "gadi", "gada", "gadiem"] }), xYears: buildLocalizeTokenFn({ one: [ "1 {{time}}", "gads", "gada"], other: [ "{{count}} {{time}}", "gads", "gadi", "gada", "gadiem"] }), overXYears: buildLocalizeTokenFn({ one: [ "ilgāk par 1 {{time}}", "gadu", "gadu"], other: [ "vairāk nekā {{count}} {{time}}", "gads", "gadi", "gada", "gadiem"] }), almostXYears: buildLocalizeTokenFn({ one: [ "gandrīz 1 {{time}}", "gads", "gada"], other: [ "vairāk nekā {{count}} {{time}}", "gads", "gadi", "gada", "gadiem"] }) }; var formatDistance = function formatDistance(token, count, options) { var result = formatDistanceLocale[token](count, options); if (options !== null && options !== void 0 && options.addSuffix) if (options.comparison && options.comparison > 0) return "pēc " + result;else return "pirms " + result; return result; }; //#endregion //#region dist/date-fns/locale/_lib/buildFormatLongFn.js function buildFormatLongFn(args) { return function () {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var width = options.width ? String(options.width) : args.defaultWidth; return args.formats[width] || args.formats[args.defaultWidth]; }; } var formatLong = { date: buildFormatLongFn({ formats: { full: "EEEE, y. 'gada' d. MMMM", long: "y. 'gada' d. MMMM", medium: "dd.MM.y.", short: "dd.MM.y." }, defaultWidth: "full" }), time: buildFormatLongFn({ formats: { full: "HH:mm:ss zzzz", long: "HH:mm:ss z", medium: "HH:mm:ss", short: "HH:mm" }, defaultWidth: "full" }), dateTime: buildFormatLongFn({ formats: { full: "{{date}} 'plkst.' {{time}}", long: "{{date}} 'plkst.' {{time}}", medium: "{{date}}, {{time}}", short: "{{date}}, {{time}}" }, defaultWidth: "full" }) }; -(Math.pow(10, 8) * 24 * 60 * 60 * 1e3); /** * @constant * @name constructFromSymbol * @summary Symbol enabling Date extensions to inherit properties from the reference date. * * The symbol is used to enable the `constructFrom` function to construct a date * using a reference date and a value. It allows to transfer extra properties * from the reference date to the new date. It's useful for extensions like * [`TZDate`](https://github.com/date-fns/tz) that accept a time zone as * a constructor argument. */ var constructFromSymbol = Symbol.for("constructDateFrom"); //#endregion //#region dist/date-fns/constructFrom.js /** * @name constructFrom * @category Generic Helpers * @summary Constructs a date using the reference date and the value * * @description * The function constructs a new date using the constructor from the reference * date and the given value. It helps to build generic functions that accept * date extensions. * * It defaults to `Date` if the passed reference date is a number or a string. * * Starting from v3.7.0, it allows to construct a date using `[Symbol.for("constructDateFrom")]` * enabling to transfer extra properties from the reference date to the new date. * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz) * that accept a time zone as a constructor argument. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * * @param date - The reference date to take constructor from * @param value - The value to create the date * * @returns Date initialized using the given date and value * * @example * import { constructFrom } from "./constructFrom/date-fns"; * * // A function that clones a date preserving the original type * function cloneDate<DateType extends Date>(date: DateType): DateType { * return constructFrom( * date, // Use constructor from the given date * date.getTime() // Use the date value to create a new date * ); * } */ function constructFrom(date, value) { if (typeof date === "function") return date(value); if (date && _typeof(date) === "object" && constructFromSymbol in date) return date[constructFromSymbol](value); if (date instanceof Date) return new date.constructor(value); return new Date(value); } //#endregion //#region dist/date-fns/_lib/normalizeDates.js function normalizeDates(context) {for (var _len = arguments.length, dates = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {dates[_key - 1] = arguments[_key];} var normalize = constructFrom.bind(null, context || dates.find(function (date) {return _typeof(date) === "object";})); return dates.map(normalize); } //#endregion //#region dist/date-fns/_lib/defaultOptions.js var defaultOptions = {}; function getDefaultOptions() { return defaultOptions; } //#endregion //#region dist/date-fns/toDate.js /** * @name toDate * @category Common Helpers * @summary Convert the given argument to an instance of Date. * * @description * Convert the given argument to an instance of Date. * * If the argument is an instance of Date, the function returns its clone. * * If the argument is a number, it is treated as a timestamp. * * If the argument is none of the above, the function returns Invalid Date. * * Starting from v3.7.0, it clones a date using `[Symbol.for("constructDateFrom")]` * enabling to transfer extra properties from the reference date to the new date. * It's useful for extensions like [`TZDate`](https://github.com/date-fns/tz) * that accept a time zone as a constructor argument. * * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param argument - The value to convert * * @returns The parsed date in the local time zone * * @example * // Clone the date: * const result = toDate(new Date(2014, 1, 11, 11, 30, 30)) * //=> Tue Feb 11 2014 11:30:30 * * @example * // Convert the timestamp to date: * const result = toDate(1392098430000) * //=> Tue Feb 11 2014 11:30:30 */ function toDate(argument, context) { return constructFrom(context || argument, argument); } //#endregion //#region dist/date-fns/startOfWeek.js /** * The {@link startOfWeek} function options. */ /** * @name startOfWeek * @category Week Helpers * @summary Return the start of a week for the given date. * * @description * Return the start of a week for the given date. * The result will be in the local timezone. * * @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc). * @typeParam ResultDate - The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments. * * @param date - The original date * @param options - An object with options * * @returns The start of a week * * @example * // The start of a week for 2 September 2014 11:55:00: * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0)) * //=> Sun Aug 31 2014 00:00:00 * * @example * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00: * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 }) * //=> Mon Sep 01 2014 00:00:00 */ function startOfWeek(date, options) {var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _defaultOptions$local; var defaultOptions = getDefaultOptions(); var weekStartsOn = (_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 || (_options$locale = options.locale) === null || _options$locale === void 0 || (_options$locale = _options$locale.options) === null || _options$locale === void 0 ? void 0 : _options$locale.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 || (_defaultOptions$local = _defaultOptions$local.options) === null || _defaultOptions$local === void 0 ? void 0 : _defaultOptions$local.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0; var _date = toDate(date, options === null || options === void 0 ? void 0 : options.in); var day = _date.getDay(); var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; _date.setDate(_date.getDate() - diff); _date.setHours(0, 0, 0, 0); return _date; } //#endregion //#region dist/date-fns/isSameWeek.js /** * The {@link isSameWeek} function options. */ /** * @name isSameWeek * @category Week Helpers * @summary Are the given dates in the same week (and month and year)? * * @description * Are the given dates in the same week (and month and year)? * * @param laterDate - The first date to check * @param earlierDate - The second date to check * @param options - An object with options * * @returns The dates are in the same week (and month and year) * * @example * // Are 31 August 2014 and 4 September 2014 in the same week? * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4)) * //=> true * * @example * // If week starts with Monday, * // are 31 August 2014 and 4 September 2014 in the same week? * const result = isSameWeek(new Date(2014, 7, 31), new Date(2014, 8, 4), { * weekStartsOn: 1 * }) * //=> false * * @example * // Are 1 January 2014 and 1 January 2015 in the same week? * const result = isSameWeek(new Date(2014, 0, 1), new Date(2015, 0, 1)) * //=> false */ function isSameWeek(laterDate, earlierDate, options) { var _normalizeDates = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates2 = _slicedToArray(_normalizeDates, 2),laterDate_ = _normalizeDates2[0],earlierDate_ = _normalizeDates2[1]; return +startOfWeek(laterDate_, options) === +startOfWeek(earlierDate_, options); } //#endregion //#region dist/date-fns/locale/lv/_lib/formatRelative.js var weekdays = [ "svētdienā", "pirmdienā", "otrdienā", "trešdienā", "ceturtdienā", "piektdienā", "sestdienā"]; var formatRelativeLocale = { lastWeek: function lastWeek(date, baseDate, options) { if (isSameWeek(date, baseDate, options)) return "eeee 'plkst.' p"; return "'Pagājušā " + weekdays[date.getDay()] + " plkst.' p"; }, yesterday: "'Vakar plkst.' p", today: "'Šodien plkst.' p", tomorrow: "'Rīt plkst.' p", nextWeek: function nextWeek(date, baseDate, options) { if (isSameWeek(date, baseDate, options)) return "eeee 'plkst.' p"; return "'Nākamajā " + weekdays[date.getDay()] + " plkst.' p"; }, other: "P" }; var formatRelative = function formatRelative(token, date, baseDate, options) { var format = formatRelativeLocale[token]; if (typeof format === "function") return format(date, baseDate, options); return format; }; //#endregion //#region dist/date-fns/locale/_lib/buildLocalizeFn.js /** * The localize function argument callback which allows to convert raw value to * the actual type. * * @param value - The value to convert * * @returns The converted value */ /** * The map of localized values for each width. */ /** * The index type of the locale unit value. It types conversion of units of * values that don't start at 0 (i.e. quarters). */ /** * Converts the unit value to the tuple of values. */ /** * The tuple of localized era values. The first element represents BC, * the second element represents AD. */ /** * The tuple of localized quarter values. The first element represents Q1. */ /** * The tuple of localized day values. The first element represents Sunday. */ /** * The tuple of localized month values. The first element represents January. */ function buildLocalizeFn(args) { return function (value, options) { var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone"; var valuesArray; if (context === "formatting" && args.formattingValues) { var defaultWidth = args.defaultFormattingWidth || args.defaultWidth; var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth; valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; } else { var _defaultWidth = args.defaultWidth; var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth; valuesArray = args.values[_width] || args.values[_defaultWidth]; } var index = args.argumentCallback ? args.argumentCallback(value) : value; return valuesArray[index]; }; } //#endregion //#region dist/date-fns/locale/lv/_lib/localize.js var eraValues = { narrow: ["p.m.ē", "m.ē"], abbreviated: ["p. m. ē.", "m. ē."], wide: ["pirms mūsu ēras", "mūsu ērā"] }; var quarterValues = { narrow: [ "1", "2", "3", "4"], abbreviated: [ "1. cet.", "2. cet.", "3. cet.", "4. cet."], wide: [ "pirmais ceturksnis", "otrais ceturksnis", "trešais ceturksnis", "ceturtais ceturksnis"] }; var formattingQuarterValues = { narrow: [ "1", "2", "3", "4"], abbreviated: [ "1. cet.", "2. cet.", "3. cet.", "4. cet."], wide: [ "pirmajā ceturksnī", "otrajā ceturksnī", "trešajā ceturksnī", "ceturtajā ceturksnī"] }; var monthValues = { narrow: [ "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], abbreviated: [ "janv.", "febr.", "marts", "apr.", "maijs", "jūn.", "jūl.", "aug.", "sept.", "okt.", "nov.", "dec."], wide: [ "janvāris", "februāris", "marts", "aprīlis", "maijs", "jūnijs", "jūlijs", "augusts", "septembris", "oktobris", "novembris", "decembris"] }; var formattingMonthValues = { narrow: [ "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], abbreviated: [ "janv.", "febr.", "martā", "apr.", "maijs", "jūn.", "jūl.", "aug.", "sept.", "okt.", "nov.", "dec."], wide: [ "janvārī", "februārī", "martā", "aprīlī", "maijā", "jūnijā", "jūlijā", "augustā", "septembrī", "oktobrī", "novembrī", "decembrī"] }; var dayValues = { narrow: [ "S", "P", "O", "T", "C", "P", "S"], short: [ "Sv", "P", "O", "T", "C", "Pk", "S"], abbreviated: [ "svētd.", "pirmd.", "otrd.", "trešd.", "ceturtd.", "piektd.", "sestd."], wide: [ "svētdiena", "pirmdiena", "otrdiena", "trešdiena", "ceturtdiena", "piektdiena", "sestdiena"] }; var formattingDayValues = { narrow: [ "S", "P", "O", "T", "C", "P", "S"], short: [ "Sv", "P", "O", "T", "C", "Pk", "S"], abbreviated: [ "svētd.", "pirmd.", "otrd.", "trešd.", "ceturtd.", "piektd.", "sestd."], wide: [ "svētdienā", "pirmdienā", "otrdienā", "trešdienā", "ceturtdienā", "piektdienā", "sestdienā"] }; var dayPeriodValues = { narrow: { am: "am", pm: "pm", midnight: "pusn.", noon: "pusd.", morning: "rīts", afternoon: "diena", evening: "vakars", night: "nakts" }, abbreviated: { am: "am", pm: "pm", midnight: "pusn.", noon: "pusd.", morning: "rīts", afternoon: "pēcpusd.", evening: "vakars", night: "nakts" }, wide: { am: "am", pm: "pm", midnight: "pusnakts", noon: "pusdienlaiks", morning: "rīts", afternoon: "pēcpusdiena", evening: "vakars", night: "nakts" } }; var formattingDayPeriodValues = { narrow: { am: "am", pm: "pm", midnight: "pusn.", noon: "pusd.", morning: "rītā", afternoon: "dienā", evening: "vakarā", night: "naktī" }, abbreviated: { am: "am", pm: "pm", midnight: "pusn.", noon: "pusd.", morning: "rītā", afternoon: "pēcpusd.", evening: "vakarā", night: "naktī" }, wide: { am: "am", pm: "pm", midnight: "pusnaktī", noon: "pusdienlaikā", morning: "rītā", afternoon: "pēcpusdienā", evening: "vakarā", night: "naktī" } }; var ordinalNumber = function ordinalNumber(dirtyNumber, _options) { return Number(dirtyNumber) + "."; }; var localize = { ordinalNumber: ordinalNumber, era: buildLocalizeFn({ values: eraValues, defaultWidth: "wide" }), quarter: buildLocalizeFn({ values: quarterValues, defaultWidth: "wide", formattingValues: formattingQuarterValues, defaultFormattingWidth: "wide", argumentCallback: function argumentCallback(quarter) {return quarter - 1;} }), month: buildLocalizeFn({ values: monthValues, defaultWidth: "wide", formattingValues: formattingMonthValues, defaultFormattingWidth: "wide" }), day: buildLocalizeFn({ values: dayValues, defaultWidth: "wide", formattingValues: formattingDayValues, defaultFormattingWidth: "wide" }), dayPeriod: buildLocalizeFn({ values: dayPeriodValues, defaultWidth: "wide", formattingValues: formattingDayPeriodValues, defaultFormattingWidth: "wide" }) }; //#endregion //#region dist/date-fns/locale/_lib/buildMatchFn.js function buildMatchFn(args) { return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var width = options.width; var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; var matchResult = string.match(matchPattern); if (!matchResult) return null; var matchedString = matchResult[0]; var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {return pattern.test(matchedString);}) : findKey(parsePatterns, function (pattern) {return pattern.test(matchedString);}); var value; value = args.valueCallback ? args.valueCallback(key) : key; value = options.valueCallback ? options.valueCallback(value) : value; var rest = string.slice(matchedString.length); return { value: value, rest: rest }; }; } function findKey(object, predicate) { for (var key in object) if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) return key; } function findIndex(array, predicate) { for (var key = 0; key < array.length; key++) if (predicate(array[key])) return key; } //#endregion //#region dist/date-fns/locale/_lib/buildMatchPatternFn.js function buildMatchPatternFn(args) { return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var matchResult = string.match(args.matchPattern); if (!matchResult) return null; var matchedString = matchResult[0]; var parseResult = string.match(args.parsePattern); if (!parseResult) return null; var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; value = options.valueCallback ? options.valueCallback(value) : value; var rest = string.slice(matchedString.length); return { value: value, rest: rest }; }; } //#endregion //#region dist/date-fns/locale/lv.js /** * @category Locales * @summary Latvian locale (Latvia). * @language Latvian * @iso-639-2 lav * @author Rūdolfs Puķītis [@prudolfs](https://github.com/prudolfs) */ var lv = { code: "lv", formatDistance: formatDistance, formatLong: formatLong, formatRelative: formatRelative, localize: localize, match: { ordinalNumber: buildMatchPatternFn({ matchPattern: /^(\d+)\./i, parsePattern: /\d+/i, valueCallback: function valueCallback(value) {return parseInt(value, 10);} }), era: buildMatchFn({ matchPatterns: { narrow: /^(p\.m\.ē|m\.ē)/i, abbreviated: /^(p\. m\. ē\.|m\. ē\.)/i, wide: /^(pirms mūsu ēras|mūsu ērā)/i }, defaultMatchWidth: "wide", parsePatterns: { any: [/^p/i, /^m/i] }, defaultParseWidth: "any" }), quarter: buildMatchFn({ matchPatterns: { narrow: /^[1234]/i, abbreviated: /^[1234](\. cet\.)/i, wide: /^(pirma(is|jā)|otra(is|jā)|treša(is|jā)|ceturta(is|jā)) ceturksn(is|ī)/i }, defaultMatchWidth: "wide", parsePatterns: { narrow: [ /^1/i, /^2/i, /^3/i, /^4/i], abbreviated: [ /^1/i, /^2/i, /^3/i, /^4/i], wide: [ /^p/i, /^o/i, /^t/i, /^c/i] }, defaultParseWidth: "wide", valueCallback: function valueCallback(index) {return index + 1;} }), month: buildMatchFn({ matchPatterns: { narrow: /^[jfmasond]/i, abbreviated: /^(janv\.|febr\.|marts|apr\.|maijs|jūn\.|jūl\.|aug\.|sept\.|okt\.|nov\.|dec\.)/i, wide: /^(janvār(is|ī)|februār(is|ī)|mart[sā]|aprīl(is|ī)|maij[sā]|jūnij[sā]|jūlij[sā]|august[sā]|septembr(is|ī)|oktobr(is|ī)|novembr(is|ī)|decembr(is|ī))/i }, defaultMatchWidth: "wide", parsePatterns: { 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, /^mai/i, /^jūn/i, /^jūl/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i] }, defaultParseWidth: "any" }), day: buildMatchFn({ matchPatterns: { narrow: /^[spotc]/i, short: /^(sv|pi|o|t|c|pk|s)/i, abbreviated: /^(svētd\.|pirmd\.|otrd.\|trešd\.|ceturtd\.|piektd\.|sestd\.)/i, wide: /^(svētdien(a|ā)|pirmdien(a|ā)|otrdien(a|ā)|trešdien(a|ā)|ceturtdien(a|ā)|piektdien(a|ā)|sestdien(a|ā))/i }, defaultMatchWidth: "wide", parsePatterns: { narrow: [ /^s/i, /^p/i, /^o/i, /^t/i, /^c/i, /^p/i, /^s/i], any: [ /^sv/i, /^pi/i, /^o/i, /^t/i, /^c/i, /^p/i, /^se/i] }, defaultParseWidth: "any" }), dayPeriod: buildMatchFn({ matchPatterns: { narrow: /^(am|pm|pusn\.|pusd\.|rīt(s|ā)|dien(a|ā)|vakar(s|ā)|nakt(s|ī))/, abbreviated: /^(am|pm|pusn\.|pusd\.|rīt(s|ā)|pēcpusd\.|vakar(s|ā)|nakt(s|ī))/, wide: /^(am|pm|pusnakt(s|ī)|pusdienlaik(s|ā)|rīt(s|ā)|pēcpusdien(a|ā)|vakar(s|ā)|nakt(s|ī))/i }, defaultMatchWidth: "wide", parsePatterns: { any: { am: /^am/i, pm: /^pm/i, midnight: /^pusn/i, noon: /^pusd/i, morning: /^r/i, afternoon: /^(d|pēc)/i, evening: /^v/i, night: /^n/i } }, defaultParseWidth: "any" }) }, options: { weekStartsOn: 1, firstWeekContainsDate: 4 } }; //#endregion //#region dist/date-fns/_entries/locale/lv/cdn.js window.dateFns = _objectSpread(_objectSpread({}, window.dateFns), {}, { locale: _objectSpread(_objectSpread({}, (_window$dateFns = window.dateFns) === null || _window$dateFns === void 0 ? void 0 : _window$dateFns.locale), {}, { lv: lv }) }); //#endregion console.log("date-fns CDN files have moved to @date-fns/cdn. Please update your URLs. See: https://date-fns.org/docs/CDN"); })();