UNPKG

date-fns

Version:

Modern JavaScript date utility library

989 lines (968 loc) 34.9 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/uk/_lib/formatDistance.js function declension(scheme, count) { if (scheme.one !== void 0 && count === 1) return scheme.one; var rem10 = count % 10; var rem100 = count % 100; if (rem10 === 1 && rem100 !== 11) return scheme.singularNominative.replace("{{count}}", String(count));else if (rem10 >= 2 && rem10 <= 4 && (rem100 < 10 || rem100 > 20)) return scheme.singularGenitive.replace("{{count}}", String(count));else return scheme.pluralGenitive.replace("{{count}}", String(count)); } function buildLocalizeTokenFn(scheme) { return function (count, options) { if (options && options.addSuffix) {if (options.comparison && options.comparison > 0) {if (scheme.future) return declension(scheme.future, count);else return "за " + declension(scheme.regular, count);} else if (scheme.past) return declension(scheme.past, count);else return declension(scheme.regular, count) + " тому";} else return declension(scheme.regular, count); }; } var halfAtMinute = function halfAtMinute(_, options) { if (options && options.addSuffix) if (options.comparison && options.comparison > 0) return "за півхвилини";else return "півхвилини тому"; return "півхвилини"; }; var formatDistanceLocale = { lessThanXSeconds: buildLocalizeTokenFn({ regular: { one: "менше секунди", singularNominative: "менше {{count}} секунди", singularGenitive: "менше {{count}} секунд", pluralGenitive: "менше {{count}} секунд" }, future: { one: "менше, ніж за секунду", singularNominative: "менше, ніж за {{count}} секунду", singularGenitive: "менше, ніж за {{count}} секунди", pluralGenitive: "менше, ніж за {{count}} секунд" } }), xSeconds: buildLocalizeTokenFn({ regular: { singularNominative: "{{count}} секунда", singularGenitive: "{{count}} секунди", pluralGenitive: "{{count}} секунд" }, past: { singularNominative: "{{count}} секунду тому", singularGenitive: "{{count}} секунди тому", pluralGenitive: "{{count}} секунд тому" }, future: { singularNominative: "за {{count}} секунду", singularGenitive: "за {{count}} секунди", pluralGenitive: "за {{count}} секунд" } }), halfAMinute: halfAtMinute, lessThanXMinutes: buildLocalizeTokenFn({ regular: { one: "менше хвилини", singularNominative: "менше {{count}} хвилини", singularGenitive: "менше {{count}} хвилин", pluralGenitive: "менше {{count}} хвилин" }, future: { one: "менше, ніж за хвилину", singularNominative: "менше, ніж за {{count}} хвилину", singularGenitive: "менше, ніж за {{count}} хвилини", pluralGenitive: "менше, ніж за {{count}} хвилин" } }), xMinutes: buildLocalizeTokenFn({ regular: { singularNominative: "{{count}} хвилина", singularGenitive: "{{count}} хвилини", pluralGenitive: "{{count}} хвилин" }, past: { singularNominative: "{{count}} хвилину тому", singularGenitive: "{{count}} хвилини тому", pluralGenitive: "{{count}} хвилин тому" }, future: { singularNominative: "за {{count}} хвилину", singularGenitive: "за {{count}} хвилини", pluralGenitive: "за {{count}} хвилин" } }), aboutXHours: buildLocalizeTokenFn({ regular: { singularNominative: "близько {{count}} години", singularGenitive: "близько {{count}} годин", pluralGenitive: "близько {{count}} годин" }, future: { singularNominative: "приблизно за {{count}} годину", singularGenitive: "приблизно за {{count}} години", pluralGenitive: "приблизно за {{count}} годин" } }), xHours: buildLocalizeTokenFn({ regular: { singularNominative: "{{count}} годину", singularGenitive: "{{count}} години", pluralGenitive: "{{count}} годин" } }), xDays: buildLocalizeTokenFn({ regular: { singularNominative: "{{count}} день", singularGenitive: "{{count}} днi", pluralGenitive: "{{count}} днів" } }), aboutXWeeks: buildLocalizeTokenFn({ regular: { singularNominative: "близько {{count}} тижня", singularGenitive: "близько {{count}} тижнів", pluralGenitive: "близько {{count}} тижнів" }, future: { singularNominative: "приблизно за {{count}} тиждень", singularGenitive: "приблизно за {{count}} тижні", pluralGenitive: "приблизно за {{count}} тижнів" } }), xWeeks: buildLocalizeTokenFn({ regular: { singularNominative: "{{count}} тиждень", singularGenitive: "{{count}} тижні", pluralGenitive: "{{count}} тижнів" } }), aboutXMonths: buildLocalizeTokenFn({ regular: { singularNominative: "близько {{count}} місяця", singularGenitive: "близько {{count}} місяців", pluralGenitive: "близько {{count}} місяців" }, future: { singularNominative: "приблизно за {{count}} місяць", singularGenitive: "приблизно за {{count}} місяці", pluralGenitive: "приблизно за {{count}} місяців" } }), xMonths: buildLocalizeTokenFn({ regular: { singularNominative: "{{count}} місяць", singularGenitive: "{{count}} місяці", pluralGenitive: "{{count}} місяців" } }), aboutXYears: buildLocalizeTokenFn({ regular: { singularNominative: "близько {{count}} року", singularGenitive: "близько {{count}} років", pluralGenitive: "близько {{count}} років" }, future: { singularNominative: "приблизно за {{count}} рік", singularGenitive: "приблизно за {{count}} роки", pluralGenitive: "приблизно за {{count}} років" } }), xYears: buildLocalizeTokenFn({ regular: { singularNominative: "{{count}} рік", singularGenitive: "{{count}} роки", pluralGenitive: "{{count}} років" } }), overXYears: buildLocalizeTokenFn({ regular: { singularNominative: "більше {{count}} року", singularGenitive: "більше {{count}} років", pluralGenitive: "більше {{count}} років" }, future: { singularNominative: "більше, ніж за {{count}} рік", singularGenitive: "більше, ніж за {{count}} роки", pluralGenitive: "більше, ніж за {{count}} років" } }), almostXYears: buildLocalizeTokenFn({ regular: { singularNominative: "майже {{count}} рік", singularGenitive: "майже {{count}} роки", pluralGenitive: "майже {{count}} років" }, future: { singularNominative: "майже за {{count}} рік", singularGenitive: "майже за {{count}} роки", pluralGenitive: "майже за {{count}} років" } }) }; var formatDistance = function formatDistance(token, count, options) { options = options || {}; return formatDistanceLocale[token](count, options); }; //#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, do MMMM y 'р.'", long: "do MMMM y 'р.'", medium: "d MMM y 'р.'", short: "dd.MM.y" }, defaultWidth: "full" }), time: buildFormatLongFn({ formats: { full: "H:mm:ss zzzz", long: "H:mm:ss z", medium: "H:mm:ss", short: "H:mm" }, defaultWidth: "full" }), dateTime: buildFormatLongFn({ formats: { full: "{{date}} 'о' {{time}}", long: "{{date}} 'о' {{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/uk/_lib/formatRelative.js var accusativeWeekdays = [ "неділю", "понеділок", "вівторок", "середу", "четвер", "п’ятницю", "суботу"]; function lastWeek(day) { var weekday = accusativeWeekdays[day]; switch (day) { case 0: case 3: case 5: case 6:return "'у минулу " + weekday + " о' p"; case 1: case 2: case 4:return "'у минулий " + weekday + " о' p"; } } function thisWeek(day) { return "'у " + accusativeWeekdays[day] + " о' p"; } function nextWeek(day) { var weekday = accusativeWeekdays[day]; switch (day) { case 0: case 3: case 5: case 6:return "'у наступну " + weekday + " о' p"; case 1: case 2: case 4:return "'у наступний " + weekday + " о' p"; } } var lastWeekFormat = function lastWeekFormat(dirtyDate, baseDate, options) { var date = toDate(dirtyDate); var day = date.getDay(); if (isSameWeek(date, baseDate, options)) return thisWeek(day);else return lastWeek(day); }; var nextWeekFormat = function nextWeekFormat(dirtyDate, baseDate, options) { var date = toDate(dirtyDate); var day = date.getDay(); if (isSameWeek(date, baseDate, options)) return thisWeek(day);else return nextWeek(day); }; var formatRelativeLocale = { lastWeek: lastWeekFormat, yesterday: "'вчора о' p", today: "'сьогодні о' p", tomorrow: "'завтра о' p", nextWeek: nextWeekFormat, 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/uk/_lib/localize.js var eraValues = { narrow: ["до н.е.", "н.е."], abbreviated: ["до н. е.", "н. е."], wide: ["до нашої ери", "нашої ери"] }; var quarterValues = { narrow: [ "1", "2", "3", "4"], abbreviated: [ "1-й кв.", "2-й кв.", "3-й кв.", "4-й кв."], wide: [ "1-й квартал", "2-й квартал", "3-й квартал", "4-й квартал"] }; var monthValues = { narrow: [ "С", "Л", "Б", "К", "Т", "Ч", "Л", "С", "В", "Ж", "Л", "Г"], abbreviated: [ "січ.", "лют.", "берез.", "квіт.", "трав.", "черв.", "лип.", "серп.", "верес.", "жовт.", "листоп.", "груд."], wide: [ "січень", "лютий", "березень", "квітень", "травень", "червень", "липень", "серпень", "вересень", "жовтень", "листопад", "грудень"] }; var formattingMonthValues = { narrow: [ "С", "Л", "Б", "К", "Т", "Ч", "Л", "С", "В", "Ж", "Л", "Г"], abbreviated: [ "січ.", "лют.", "берез.", "квіт.", "трав.", "черв.", "лип.", "серп.", "верес.", "жовт.", "листоп.", "груд."], wide: [ "січня", "лютого", "березня", "квітня", "травня", "червня", "липня", "серпня", "вересня", "жовтня", "листопада", "грудня"] }; var dayValues = { narrow: [ "Н", "П", "В", "С", "Ч", "П", "С"], short: [ "нд", "пн", "вт", "ср", "чт", "пт", "сб"], abbreviated: [ "нед", "пон", "вів", "сер", "чтв", "птн", "суб"], wide: [ "неділя", "понеділок", "вівторок", "середа", "четвер", "п’ятниця", "субота"] }; var dayPeriodValues = { 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: "ніч" } }; var formattingDayPeriodValues = { 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: "ночі" } }; var ordinalNumber = function ordinalNumber(dirtyNumber, options) { var unit = String(options === null || options === void 0 ? void 0 : options.unit); var number = Number(dirtyNumber); var suffix; if (unit === "date") {if (number === 3 || number === 23) suffix = "-є";else suffix = "-е";} else if (unit === "minute" || unit === "second" || unit === "hour") suffix = "-а";else suffix = "-й"; return number + suffix; }; var localize = { ordinalNumber: ordinalNumber, era: buildLocalizeFn({ values: eraValues, defaultWidth: "wide" }), quarter: buildLocalizeFn({ values: quarterValues, defaultWidth: "wide", argumentCallback: function argumentCallback(quarter) {return quarter - 1;} }), month: buildLocalizeFn({ values: monthValues, defaultWidth: "wide", formattingValues: formattingMonthValues, defaultFormattingWidth: "wide" }), day: buildLocalizeFn({ values: dayValues, defaultWidth: "wide" }), dayPeriod: buildLocalizeFn({ values: dayPeriodValues, defaultWidth: "any", 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/uk.js /** * @category Locales * @summary Ukrainian locale. * @language Ukrainian * @iso-639-2 ukr * @author Andrii Korzh [@korzhyk](https://github.com/korzhyk) * @author Andriy Shcherbyak [@shcherbyakdev](https://github.com/shcherbyakdev) */ var uk = { code: "uk", 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: /^((до )?н\.?\s?е\.?)/i, abbreviated: /^((до )?н\.?\s?е\.?)/i, wide: /^(до нашої ери|нашої ери|наша ера)/i }, defaultMatchWidth: "wide", parsePatterns: { any: [/^д/i, /^н/i] }, defaultParseWidth: "any" }), quarter: buildMatchFn({ matchPatterns: { narrow: /^[1234]/i, abbreviated: /^[1234](-?[иі]?й?)? кв.?/i, wide: /^[1234](-?[иі]?й?)? квартал/i }, defaultMatchWidth: "wide", parsePatterns: { any: [ /1/i, /2/i, /3/i, /4/i] }, defaultParseWidth: "any", valueCallback: function valueCallback(index) {return index + 1;} }), month: buildMatchFn({ matchPatterns: { narrow: /^[слбктчвжг]/i, abbreviated: /^(січ|лют|бер(ез)?|квіт|трав|черв|лип|серп|вер(ес)?|жовт|лис(топ)?|груд)\.?/i, wide: /^(січень|січня|лютий|лютого|березень|березня|квітень|квітня|травень|травня|червня|червень|липень|липня|серпень|серпня|вересень|вересня|жовтень|жовтня|листопад[а]?|грудень|грудня)/i }, defaultMatchWidth: "wide", parsePatterns: { 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] }, defaultParseWidth: "any" }), day: buildMatchFn({ matchPatterns: { narrow: /^[нпвсч]/i, short: /^(нд|пн|вт|ср|чт|пт|сб)\.?/i, abbreviated: /^(нед|пон|вів|сер|че?тв|птн?|суб)\.?/i, wide: /^(неділ[яі]|понеділ[ок][ка]|вівтор[ок][ка]|серед[аи]|четвер(га)?|п\W*?ятниц[яі]|субот[аи])/i }, defaultMatchWidth: "wide", parsePatterns: { narrow: [ /^н/i, /^п/i, /^в/i, /^с/i, /^ч/i, /^п/i, /^с/i], any: [ /^н/i, /^п[он]/i, /^в/i, /^с[ер]/i, /^ч/i, /^п\W*?[ят]/i, /^с[уб]/i] }, defaultParseWidth: "any" }), dayPeriod: buildMatchFn({ matchPatterns: { narrow: /^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i, abbreviated: /^([дп]п|півн\.?|пол\.?|ранок|ранку|день|дня|веч\.?|ніч|ночі)/i, wide: /^([дп]п|північ|полудень|ранок|ранку|день|дня|вечір|вечора|ніч|ночі)/i }, defaultMatchWidth: "wide", parsePatterns: { any: { am: /^дп/i, pm: /^пп/i, midnight: /^півн/i, noon: /^пол/i, morning: /^р/i, afternoon: /^д[ен]/i, evening: /^в/i, night: /^н/i } }, defaultParseWidth: "any" }) }, options: { weekStartsOn: 1, firstWeekContainsDate: 1 } }; //#endregion //#region dist/date-fns/_entries/locale/uk/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), {}, { uk: uk }) }); //#endregion console.log("date-fns CDN files have moved to @date-fns/cdn. Please update your URLs. See: https://date-fns.org/docs/CDN"); })();