From e4fa1e69e7ebfb627c7198fd1a9881e9327ec4d4 Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 28 Jun 2025 17:26:46 -0700 Subject: initial commit: scaffolding --- .../date-fns/esm/_lib/addLeadingZeros/index.js | 8 + node_modules/date-fns/esm/_lib/assign/index.js | 12 + .../date-fns/esm/_lib/cloneObject/index.js | 4 + .../date-fns/esm/_lib/defaultLocale/index.js | 2 + .../date-fns/esm/_lib/defaultOptions/index.js | 7 + .../date-fns/esm/_lib/format/formatters/index.js | 772 +++++++++++++++++++++ .../esm/_lib/format/lightFormatters/index.js | 80 +++ .../esm/_lib/format/longFormatters/index.js | 80 +++ .../_lib/getTimezoneOffsetInMilliseconds/index.js | 16 + .../date-fns/esm/_lib/getUTCDayOfYear/index.js | 13 + .../date-fns/esm/_lib/getUTCISOWeek/index.js | 15 + .../date-fns/esm/_lib/getUTCISOWeekYear/index.js | 23 + node_modules/date-fns/esm/_lib/getUTCWeek/index.js | 15 + .../date-fns/esm/_lib/getUTCWeekYear/index.js | 33 + .../date-fns/esm/_lib/isSameUTCWeek/index.js | 8 + .../date-fns/esm/_lib/protectedTokens/index.js | 19 + .../date-fns/esm/_lib/requiredArgs/index.js | 5 + .../date-fns/esm/_lib/roundingMethods/index.js | 13 + node_modules/date-fns/esm/_lib/setUTCDay/index.js | 23 + .../date-fns/esm/_lib/setUTCISODay/index.js | 18 + .../date-fns/esm/_lib/setUTCISOWeek/index.js | 12 + node_modules/date-fns/esm/_lib/setUTCWeek/index.js | 12 + .../date-fns/esm/_lib/startOfUTCISOWeek/index.js | 12 + .../esm/_lib/startOfUTCISOWeekYear/index.js | 12 + .../date-fns/esm/_lib/startOfUTCWeek/index.js | 21 + .../date-fns/esm/_lib/startOfUTCWeekYear/index.js | 17 + node_modules/date-fns/esm/_lib/test/index.js | 24 + node_modules/date-fns/esm/_lib/toInteger/index.js | 10 + 28 files changed, 1286 insertions(+) create mode 100644 node_modules/date-fns/esm/_lib/addLeadingZeros/index.js create mode 100644 node_modules/date-fns/esm/_lib/assign/index.js create mode 100644 node_modules/date-fns/esm/_lib/cloneObject/index.js create mode 100644 node_modules/date-fns/esm/_lib/defaultLocale/index.js create mode 100644 node_modules/date-fns/esm/_lib/defaultOptions/index.js create mode 100644 node_modules/date-fns/esm/_lib/format/formatters/index.js create mode 100644 node_modules/date-fns/esm/_lib/format/lightFormatters/index.js create mode 100644 node_modules/date-fns/esm/_lib/format/longFormatters/index.js create mode 100644 node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js create mode 100644 node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js create mode 100644 node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js create mode 100644 node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js create mode 100644 node_modules/date-fns/esm/_lib/getUTCWeek/index.js create mode 100644 node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js create mode 100644 node_modules/date-fns/esm/_lib/isSameUTCWeek/index.js create mode 100644 node_modules/date-fns/esm/_lib/protectedTokens/index.js create mode 100644 node_modules/date-fns/esm/_lib/requiredArgs/index.js create mode 100644 node_modules/date-fns/esm/_lib/roundingMethods/index.js create mode 100644 node_modules/date-fns/esm/_lib/setUTCDay/index.js create mode 100644 node_modules/date-fns/esm/_lib/setUTCISODay/index.js create mode 100644 node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js create mode 100644 node_modules/date-fns/esm/_lib/setUTCWeek/index.js create mode 100644 node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js create mode 100644 node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js create mode 100644 node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js create mode 100644 node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js create mode 100644 node_modules/date-fns/esm/_lib/test/index.js create mode 100644 node_modules/date-fns/esm/_lib/toInteger/index.js (limited to 'node_modules/date-fns/esm/_lib') diff --git a/node_modules/date-fns/esm/_lib/addLeadingZeros/index.js b/node_modules/date-fns/esm/_lib/addLeadingZeros/index.js new file mode 100644 index 0000000..e16dacb --- /dev/null +++ b/node_modules/date-fns/esm/_lib/addLeadingZeros/index.js @@ -0,0 +1,8 @@ +export default function addLeadingZeros(number, targetLength) { + var sign = number < 0 ? '-' : ''; + var output = Math.abs(number).toString(); + while (output.length < targetLength) { + output = '0' + output; + } + return sign + output; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/assign/index.js b/node_modules/date-fns/esm/_lib/assign/index.js new file mode 100644 index 0000000..227bd88 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/assign/index.js @@ -0,0 +1,12 @@ +export default function assign(target, object) { + if (target == null) { + throw new TypeError('assign requires that input parameter not be null or undefined'); + } + for (var property in object) { + if (Object.prototype.hasOwnProperty.call(object, property)) { + ; + target[property] = object[property]; + } + } + return target; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/cloneObject/index.js b/node_modules/date-fns/esm/_lib/cloneObject/index.js new file mode 100644 index 0000000..632e94e --- /dev/null +++ b/node_modules/date-fns/esm/_lib/cloneObject/index.js @@ -0,0 +1,4 @@ +import assign from "../assign/index.js"; +export default function cloneObject(object) { + return assign({}, object); +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/defaultLocale/index.js b/node_modules/date-fns/esm/_lib/defaultLocale/index.js new file mode 100644 index 0000000..0e30a13 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/defaultLocale/index.js @@ -0,0 +1,2 @@ +import defaultLocale from "../../locale/en-US/index.js"; +export default defaultLocale; \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/defaultOptions/index.js b/node_modules/date-fns/esm/_lib/defaultOptions/index.js new file mode 100644 index 0000000..4489fa6 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/defaultOptions/index.js @@ -0,0 +1,7 @@ +var defaultOptions = {}; +export function getDefaultOptions() { + return defaultOptions; +} +export function setDefaultOptions(newOptions) { + defaultOptions = newOptions; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/format/formatters/index.js b/node_modules/date-fns/esm/_lib/format/formatters/index.js new file mode 100644 index 0000000..dda74bf --- /dev/null +++ b/node_modules/date-fns/esm/_lib/format/formatters/index.js @@ -0,0 +1,772 @@ +import getUTCDayOfYear from "../../../_lib/getUTCDayOfYear/index.js"; +import getUTCISOWeek from "../../../_lib/getUTCISOWeek/index.js"; +import getUTCISOWeekYear from "../../../_lib/getUTCISOWeekYear/index.js"; +import getUTCWeek from "../../../_lib/getUTCWeek/index.js"; +import getUTCWeekYear from "../../../_lib/getUTCWeekYear/index.js"; +import addLeadingZeros from "../../addLeadingZeros/index.js"; +import lightFormatters from "../lightFormatters/index.js"; +var dayPeriodEnum = { + am: 'am', + pm: 'pm', + midnight: 'midnight', + noon: 'noon', + morning: 'morning', + afternoon: 'afternoon', + evening: 'evening', + night: 'night' +}; +/* + * | | Unit | | Unit | + * |-----|--------------------------------|-----|--------------------------------| + * | a | AM, PM | A* | Milliseconds in day | + * | b | AM, PM, noon, midnight | B | Flexible day period | + * | c | Stand-alone local day of week | C* | Localized hour w/ day period | + * | d | Day of month | D | Day of year | + * | e | Local day of week | E | Day of week | + * | f | | F* | Day of week in month | + * | g* | Modified Julian day | G | Era | + * | h | Hour [1-12] | H | Hour [0-23] | + * | i! | ISO day of week | I! | ISO week of year | + * | j* | Localized hour w/ day period | J* | Localized hour w/o day period | + * | k | Hour [1-24] | K | Hour [0-11] | + * | l* | (deprecated) | L | Stand-alone month | + * | m | Minute | M | Month | + * | n | | N | | + * | o! | Ordinal number modifier | O | Timezone (GMT) | + * | p! | Long localized time | P! | Long localized date | + * | q | Stand-alone quarter | Q | Quarter | + * | r* | Related Gregorian year | R! | ISO week-numbering year | + * | s | Second | S | Fraction of second | + * | t! | Seconds timestamp | T! | Milliseconds timestamp | + * | u | Extended year | U* | Cyclic year | + * | v* | Timezone (generic non-locat.) | V* | Timezone (location) | + * | w | Local week of year | W* | Week of month | + * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) | + * | y | Year (abs) | Y | Local week-numbering year | + * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) | + * + * Letters marked by * are not implemented but reserved by Unicode standard. + * + * Letters marked by ! are non-standard, but implemented by date-fns: + * - `o` modifies the previous token to turn it into an ordinal (see `format` docs) + * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days, + * i.e. 7 for Sunday, 1 for Monday, etc. + * - `I` is ISO week of year, as opposed to `w` which is local week of year. + * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year. + * `R` is supposed to be used in conjunction with `I` and `i` + * for universal ISO week-numbering date, whereas + * `Y` is supposed to be used in conjunction with `w` and `e` + * for week-numbering date specific to the locale. + * - `P` is long localized date format + * - `p` is long localized time format + */ + +var formatters = { + // Era + G: function G(date, token, localize) { + var era = date.getUTCFullYear() > 0 ? 1 : 0; + switch (token) { + // AD, BC + case 'G': + case 'GG': + case 'GGG': + return localize.era(era, { + width: 'abbreviated' + }); + // A, B + case 'GGGGG': + return localize.era(era, { + width: 'narrow' + }); + // Anno Domini, Before Christ + case 'GGGG': + default: + return localize.era(era, { + width: 'wide' + }); + } + }, + // Year + y: function y(date, token, localize) { + // Ordinal number + if (token === 'yo') { + var signedYear = date.getUTCFullYear(); + // Returns 1 for 1 BC (which is year 0 in JavaScript) + var year = signedYear > 0 ? signedYear : 1 - signedYear; + return localize.ordinalNumber(year, { + unit: 'year' + }); + } + return lightFormatters.y(date, token); + }, + // Local week-numbering year + Y: function Y(date, token, localize, options) { + var signedWeekYear = getUTCWeekYear(date, options); + // Returns 1 for 1 BC (which is year 0 in JavaScript) + var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; + + // Two digit year + if (token === 'YY') { + var twoDigitYear = weekYear % 100; + return addLeadingZeros(twoDigitYear, 2); + } + + // Ordinal number + if (token === 'Yo') { + return localize.ordinalNumber(weekYear, { + unit: 'year' + }); + } + + // Padding + return addLeadingZeros(weekYear, token.length); + }, + // ISO week-numbering year + R: function R(date, token) { + var isoWeekYear = getUTCISOWeekYear(date); + + // Padding + return addLeadingZeros(isoWeekYear, token.length); + }, + // Extended year. This is a single number designating the year of this calendar system. + // The main difference between `y` and `u` localizers are B.C. years: + // | Year | `y` | `u` | + // |------|-----|-----| + // | AC 1 | 1 | 1 | + // | BC 1 | 1 | 0 | + // | BC 2 | 2 | -1 | + // Also `yy` always returns the last two digits of a year, + // while `uu` pads single digit years to 2 characters and returns other years unchanged. + u: function u(date, token) { + var year = date.getUTCFullYear(); + return addLeadingZeros(year, token.length); + }, + // Quarter + Q: function Q(date, token, localize) { + var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); + switch (token) { + // 1, 2, 3, 4 + case 'Q': + return String(quarter); + // 01, 02, 03, 04 + case 'QQ': + return addLeadingZeros(quarter, 2); + // 1st, 2nd, 3rd, 4th + case 'Qo': + return localize.ordinalNumber(quarter, { + unit: 'quarter' + }); + // Q1, Q2, Q3, Q4 + case 'QQQ': + return localize.quarter(quarter, { + width: 'abbreviated', + context: 'formatting' + }); + // 1, 2, 3, 4 (narrow quarter; could be not numerical) + case 'QQQQQ': + return localize.quarter(quarter, { + width: 'narrow', + context: 'formatting' + }); + // 1st quarter, 2nd quarter, ... + case 'QQQQ': + default: + return localize.quarter(quarter, { + width: 'wide', + context: 'formatting' + }); + } + }, + // Stand-alone quarter + q: function q(date, token, localize) { + var quarter = Math.ceil((date.getUTCMonth() + 1) / 3); + switch (token) { + // 1, 2, 3, 4 + case 'q': + return String(quarter); + // 01, 02, 03, 04 + case 'qq': + return addLeadingZeros(quarter, 2); + // 1st, 2nd, 3rd, 4th + case 'qo': + return localize.ordinalNumber(quarter, { + unit: 'quarter' + }); + // Q1, Q2, Q3, Q4 + case 'qqq': + return localize.quarter(quarter, { + width: 'abbreviated', + context: 'standalone' + }); + // 1, 2, 3, 4 (narrow quarter; could be not numerical) + case 'qqqqq': + return localize.quarter(quarter, { + width: 'narrow', + context: 'standalone' + }); + // 1st quarter, 2nd quarter, ... + case 'qqqq': + default: + return localize.quarter(quarter, { + width: 'wide', + context: 'standalone' + }); + } + }, + // Month + M: function M(date, token, localize) { + var month = date.getUTCMonth(); + switch (token) { + case 'M': + case 'MM': + return lightFormatters.M(date, token); + // 1st, 2nd, ..., 12th + case 'Mo': + return localize.ordinalNumber(month + 1, { + unit: 'month' + }); + // Jan, Feb, ..., Dec + case 'MMM': + return localize.month(month, { + width: 'abbreviated', + context: 'formatting' + }); + // J, F, ..., D + case 'MMMMM': + return localize.month(month, { + width: 'narrow', + context: 'formatting' + }); + // January, February, ..., December + case 'MMMM': + default: + return localize.month(month, { + width: 'wide', + context: 'formatting' + }); + } + }, + // Stand-alone month + L: function L(date, token, localize) { + var month = date.getUTCMonth(); + switch (token) { + // 1, 2, ..., 12 + case 'L': + return String(month + 1); + // 01, 02, ..., 12 + case 'LL': + return addLeadingZeros(month + 1, 2); + // 1st, 2nd, ..., 12th + case 'Lo': + return localize.ordinalNumber(month + 1, { + unit: 'month' + }); + // Jan, Feb, ..., Dec + case 'LLL': + return localize.month(month, { + width: 'abbreviated', + context: 'standalone' + }); + // J, F, ..., D + case 'LLLLL': + return localize.month(month, { + width: 'narrow', + context: 'standalone' + }); + // January, February, ..., December + case 'LLLL': + default: + return localize.month(month, { + width: 'wide', + context: 'standalone' + }); + } + }, + // Local week of year + w: function w(date, token, localize, options) { + var week = getUTCWeek(date, options); + if (token === 'wo') { + return localize.ordinalNumber(week, { + unit: 'week' + }); + } + return addLeadingZeros(week, token.length); + }, + // ISO week of year + I: function I(date, token, localize) { + var isoWeek = getUTCISOWeek(date); + if (token === 'Io') { + return localize.ordinalNumber(isoWeek, { + unit: 'week' + }); + } + return addLeadingZeros(isoWeek, token.length); + }, + // Day of the month + d: function d(date, token, localize) { + if (token === 'do') { + return localize.ordinalNumber(date.getUTCDate(), { + unit: 'date' + }); + } + return lightFormatters.d(date, token); + }, + // Day of year + D: function D(date, token, localize) { + var dayOfYear = getUTCDayOfYear(date); + if (token === 'Do') { + return localize.ordinalNumber(dayOfYear, { + unit: 'dayOfYear' + }); + } + return addLeadingZeros(dayOfYear, token.length); + }, + // Day of week + E: function E(date, token, localize) { + var dayOfWeek = date.getUTCDay(); + switch (token) { + // Tue + case 'E': + case 'EE': + case 'EEE': + return localize.day(dayOfWeek, { + width: 'abbreviated', + context: 'formatting' + }); + // T + case 'EEEEE': + return localize.day(dayOfWeek, { + width: 'narrow', + context: 'formatting' + }); + // Tu + case 'EEEEEE': + return localize.day(dayOfWeek, { + width: 'short', + context: 'formatting' + }); + // Tuesday + case 'EEEE': + default: + return localize.day(dayOfWeek, { + width: 'wide', + context: 'formatting' + }); + } + }, + // Local day of week + e: function e(date, token, localize, options) { + var dayOfWeek = date.getUTCDay(); + var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; + switch (token) { + // Numerical value (Nth day of week with current locale or weekStartsOn) + case 'e': + return String(localDayOfWeek); + // Padded numerical value + case 'ee': + return addLeadingZeros(localDayOfWeek, 2); + // 1st, 2nd, ..., 7th + case 'eo': + return localize.ordinalNumber(localDayOfWeek, { + unit: 'day' + }); + case 'eee': + return localize.day(dayOfWeek, { + width: 'abbreviated', + context: 'formatting' + }); + // T + case 'eeeee': + return localize.day(dayOfWeek, { + width: 'narrow', + context: 'formatting' + }); + // Tu + case 'eeeeee': + return localize.day(dayOfWeek, { + width: 'short', + context: 'formatting' + }); + // Tuesday + case 'eeee': + default: + return localize.day(dayOfWeek, { + width: 'wide', + context: 'formatting' + }); + } + }, + // Stand-alone local day of week + c: function c(date, token, localize, options) { + var dayOfWeek = date.getUTCDay(); + var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; + switch (token) { + // Numerical value (same as in `e`) + case 'c': + return String(localDayOfWeek); + // Padded numerical value + case 'cc': + return addLeadingZeros(localDayOfWeek, token.length); + // 1st, 2nd, ..., 7th + case 'co': + return localize.ordinalNumber(localDayOfWeek, { + unit: 'day' + }); + case 'ccc': + return localize.day(dayOfWeek, { + width: 'abbreviated', + context: 'standalone' + }); + // T + case 'ccccc': + return localize.day(dayOfWeek, { + width: 'narrow', + context: 'standalone' + }); + // Tu + case 'cccccc': + return localize.day(dayOfWeek, { + width: 'short', + context: 'standalone' + }); + // Tuesday + case 'cccc': + default: + return localize.day(dayOfWeek, { + width: 'wide', + context: 'standalone' + }); + } + }, + // ISO day of week + i: function i(date, token, localize) { + var dayOfWeek = date.getUTCDay(); + var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; + switch (token) { + // 2 + case 'i': + return String(isoDayOfWeek); + // 02 + case 'ii': + return addLeadingZeros(isoDayOfWeek, token.length); + // 2nd + case 'io': + return localize.ordinalNumber(isoDayOfWeek, { + unit: 'day' + }); + // Tue + case 'iii': + return localize.day(dayOfWeek, { + width: 'abbreviated', + context: 'formatting' + }); + // T + case 'iiiii': + return localize.day(dayOfWeek, { + width: 'narrow', + context: 'formatting' + }); + // Tu + case 'iiiiii': + return localize.day(dayOfWeek, { + width: 'short', + context: 'formatting' + }); + // Tuesday + case 'iiii': + default: + return localize.day(dayOfWeek, { + width: 'wide', + context: 'formatting' + }); + } + }, + // AM or PM + a: function a(date, token, localize) { + var hours = date.getUTCHours(); + var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am'; + switch (token) { + case 'a': + case 'aa': + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'abbreviated', + context: 'formatting' + }); + case 'aaa': + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'abbreviated', + context: 'formatting' + }).toLowerCase(); + case 'aaaaa': + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'narrow', + context: 'formatting' + }); + case 'aaaa': + default: + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'wide', + context: 'formatting' + }); + } + }, + // AM, PM, midnight, noon + b: function b(date, token, localize) { + var hours = date.getUTCHours(); + var dayPeriodEnumValue; + if (hours === 12) { + dayPeriodEnumValue = dayPeriodEnum.noon; + } else if (hours === 0) { + dayPeriodEnumValue = dayPeriodEnum.midnight; + } else { + dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am'; + } + switch (token) { + case 'b': + case 'bb': + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'abbreviated', + context: 'formatting' + }); + case 'bbb': + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'abbreviated', + context: 'formatting' + }).toLowerCase(); + case 'bbbbb': + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'narrow', + context: 'formatting' + }); + case 'bbbb': + default: + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'wide', + context: 'formatting' + }); + } + }, + // in the morning, in the afternoon, in the evening, at night + B: function B(date, token, localize) { + var hours = date.getUTCHours(); + var dayPeriodEnumValue; + if (hours >= 17) { + dayPeriodEnumValue = dayPeriodEnum.evening; + } else if (hours >= 12) { + dayPeriodEnumValue = dayPeriodEnum.afternoon; + } else if (hours >= 4) { + dayPeriodEnumValue = dayPeriodEnum.morning; + } else { + dayPeriodEnumValue = dayPeriodEnum.night; + } + switch (token) { + case 'B': + case 'BB': + case 'BBB': + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'abbreviated', + context: 'formatting' + }); + case 'BBBBB': + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'narrow', + context: 'formatting' + }); + case 'BBBB': + default: + return localize.dayPeriod(dayPeriodEnumValue, { + width: 'wide', + context: 'formatting' + }); + } + }, + // Hour [1-12] + h: function h(date, token, localize) { + if (token === 'ho') { + var hours = date.getUTCHours() % 12; + if (hours === 0) hours = 12; + return localize.ordinalNumber(hours, { + unit: 'hour' + }); + } + return lightFormatters.h(date, token); + }, + // Hour [0-23] + H: function H(date, token, localize) { + if (token === 'Ho') { + return localize.ordinalNumber(date.getUTCHours(), { + unit: 'hour' + }); + } + return lightFormatters.H(date, token); + }, + // Hour [0-11] + K: function K(date, token, localize) { + var hours = date.getUTCHours() % 12; + if (token === 'Ko') { + return localize.ordinalNumber(hours, { + unit: 'hour' + }); + } + return addLeadingZeros(hours, token.length); + }, + // Hour [1-24] + k: function k(date, token, localize) { + var hours = date.getUTCHours(); + if (hours === 0) hours = 24; + if (token === 'ko') { + return localize.ordinalNumber(hours, { + unit: 'hour' + }); + } + return addLeadingZeros(hours, token.length); + }, + // Minute + m: function m(date, token, localize) { + if (token === 'mo') { + return localize.ordinalNumber(date.getUTCMinutes(), { + unit: 'minute' + }); + } + return lightFormatters.m(date, token); + }, + // Second + s: function s(date, token, localize) { + if (token === 'so') { + return localize.ordinalNumber(date.getUTCSeconds(), { + unit: 'second' + }); + } + return lightFormatters.s(date, token); + }, + // Fraction of second + S: function S(date, token) { + return lightFormatters.S(date, token); + }, + // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) + X: function X(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); + if (timezoneOffset === 0) { + return 'Z'; + } + switch (token) { + // Hours and optional minutes + case 'X': + return formatTimezoneWithOptionalMinutes(timezoneOffset); + + // Hours, minutes and optional seconds without `:` delimiter + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets + // so this token always has the same output as `XX` + case 'XXXX': + case 'XX': + // Hours and minutes without `:` delimiter + return formatTimezone(timezoneOffset); + + // Hours, minutes and optional seconds with `:` delimiter + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets + // so this token always has the same output as `XXX` + case 'XXXXX': + case 'XXX': // Hours and minutes with `:` delimiter + default: + return formatTimezone(timezoneOffset, ':'); + } + }, + // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) + x: function x(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); + switch (token) { + // Hours and optional minutes + case 'x': + return formatTimezoneWithOptionalMinutes(timezoneOffset); + + // Hours, minutes and optional seconds without `:` delimiter + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets + // so this token always has the same output as `xx` + case 'xxxx': + case 'xx': + // Hours and minutes without `:` delimiter + return formatTimezone(timezoneOffset); + + // Hours, minutes and optional seconds with `:` delimiter + // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets + // so this token always has the same output as `xxx` + case 'xxxxx': + case 'xxx': // Hours and minutes with `:` delimiter + default: + return formatTimezone(timezoneOffset, ':'); + } + }, + // Timezone (GMT) + O: function O(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); + switch (token) { + // Short + case 'O': + case 'OO': + case 'OOO': + return 'GMT' + formatTimezoneShort(timezoneOffset, ':'); + // Long + case 'OOOO': + default: + return 'GMT' + formatTimezone(timezoneOffset, ':'); + } + }, + // Timezone (specific non-location) + z: function z(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timezoneOffset = originalDate.getTimezoneOffset(); + switch (token) { + // Short + case 'z': + case 'zz': + case 'zzz': + return 'GMT' + formatTimezoneShort(timezoneOffset, ':'); + // Long + case 'zzzz': + default: + return 'GMT' + formatTimezone(timezoneOffset, ':'); + } + }, + // Seconds timestamp + t: function t(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timestamp = Math.floor(originalDate.getTime() / 1000); + return addLeadingZeros(timestamp, token.length); + }, + // Milliseconds timestamp + T: function T(date, token, _localize, options) { + var originalDate = options._originalDate || date; + var timestamp = originalDate.getTime(); + return addLeadingZeros(timestamp, token.length); + } +}; +function formatTimezoneShort(offset, dirtyDelimiter) { + var sign = offset > 0 ? '-' : '+'; + var absOffset = Math.abs(offset); + var hours = Math.floor(absOffset / 60); + var minutes = absOffset % 60; + if (minutes === 0) { + return sign + String(hours); + } + var delimiter = dirtyDelimiter || ''; + return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); +} +function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) { + if (offset % 60 === 0) { + var sign = offset > 0 ? '-' : '+'; + return sign + addLeadingZeros(Math.abs(offset) / 60, 2); + } + return formatTimezone(offset, dirtyDelimiter); +} +function formatTimezone(offset, dirtyDelimiter) { + var delimiter = dirtyDelimiter || ''; + var sign = offset > 0 ? '-' : '+'; + var absOffset = Math.abs(offset); + var hours = addLeadingZeros(Math.floor(absOffset / 60), 2); + var minutes = addLeadingZeros(absOffset % 60, 2); + return sign + hours + delimiter + minutes; +} +export default formatters; \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/format/lightFormatters/index.js b/node_modules/date-fns/esm/_lib/format/lightFormatters/index.js new file mode 100644 index 0000000..98c9308 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/format/lightFormatters/index.js @@ -0,0 +1,80 @@ +import addLeadingZeros from "../../addLeadingZeros/index.js"; +/* + * | | Unit | | Unit | + * |-----|--------------------------------|-----|--------------------------------| + * | a | AM, PM | A* | | + * | d | Day of month | D | | + * | h | Hour [1-12] | H | Hour [0-23] | + * | m | Minute | M | Month | + * | s | Second | S | Fraction of second | + * | y | Year (abs) | Y | | + * + * Letters marked by * are not implemented but reserved by Unicode standard. + */ +var formatters = { + // Year + y: function y(date, token) { + // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens + // | Year | y | yy | yyy | yyyy | yyyyy | + // |----------|-------|----|-------|-------|-------| + // | AD 1 | 1 | 01 | 001 | 0001 | 00001 | + // | AD 12 | 12 | 12 | 012 | 0012 | 00012 | + // | AD 123 | 123 | 23 | 123 | 0123 | 00123 | + // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 | + // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 | + + var signedYear = date.getUTCFullYear(); + // Returns 1 for 1 BC (which is year 0 in JavaScript) + var year = signedYear > 0 ? signedYear : 1 - signedYear; + return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length); + }, + // Month + M: function M(date, token) { + var month = date.getUTCMonth(); + return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2); + }, + // Day of the month + d: function d(date, token) { + return addLeadingZeros(date.getUTCDate(), token.length); + }, + // AM or PM + a: function a(date, token) { + var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am'; + switch (token) { + case 'a': + case 'aa': + return dayPeriodEnumValue.toUpperCase(); + case 'aaa': + return dayPeriodEnumValue; + case 'aaaaa': + return dayPeriodEnumValue[0]; + case 'aaaa': + default: + return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.'; + } + }, + // Hour [1-12] + h: function h(date, token) { + return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length); + }, + // Hour [0-23] + H: function H(date, token) { + return addLeadingZeros(date.getUTCHours(), token.length); + }, + // Minute + m: function m(date, token) { + return addLeadingZeros(date.getUTCMinutes(), token.length); + }, + // Second + s: function s(date, token) { + return addLeadingZeros(date.getUTCSeconds(), token.length); + }, + // Fraction of second + S: function S(date, token) { + var numberOfDigits = token.length; + var milliseconds = date.getUTCMilliseconds(); + var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3)); + return addLeadingZeros(fractionalSeconds, token.length); + } +}; +export default formatters; \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/format/longFormatters/index.js b/node_modules/date-fns/esm/_lib/format/longFormatters/index.js new file mode 100644 index 0000000..43aa5d6 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/format/longFormatters/index.js @@ -0,0 +1,80 @@ +var dateLongFormatter = function dateLongFormatter(pattern, formatLong) { + switch (pattern) { + case 'P': + return formatLong.date({ + width: 'short' + }); + case 'PP': + return formatLong.date({ + width: 'medium' + }); + case 'PPP': + return formatLong.date({ + width: 'long' + }); + case 'PPPP': + default: + return formatLong.date({ + width: 'full' + }); + } +}; +var timeLongFormatter = function timeLongFormatter(pattern, formatLong) { + switch (pattern) { + case 'p': + return formatLong.time({ + width: 'short' + }); + case 'pp': + return formatLong.time({ + width: 'medium' + }); + case 'ppp': + return formatLong.time({ + width: 'long' + }); + case 'pppp': + default: + return formatLong.time({ + width: 'full' + }); + } +}; +var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) { + var matchResult = pattern.match(/(P+)(p+)?/) || []; + var datePattern = matchResult[1]; + var timePattern = matchResult[2]; + if (!timePattern) { + return dateLongFormatter(pattern, formatLong); + } + var dateTimeFormat; + switch (datePattern) { + case 'P': + dateTimeFormat = formatLong.dateTime({ + width: 'short' + }); + break; + case 'PP': + dateTimeFormat = formatLong.dateTime({ + width: 'medium' + }); + break; + case 'PPP': + dateTimeFormat = formatLong.dateTime({ + width: 'long' + }); + break; + case 'PPPP': + default: + dateTimeFormat = formatLong.dateTime({ + width: 'full' + }); + break; + } + return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong)); +}; +var longFormatters = { + p: timeLongFormatter, + P: dateTimeLongFormatter +}; +export default longFormatters; \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js b/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js new file mode 100644 index 0000000..65b6e1b --- /dev/null +++ b/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js @@ -0,0 +1,16 @@ +/** + * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds. + * They usually appear for dates that denote time before the timezones were introduced + * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891 + * and GMT+01:00:00 after that date) + * + * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above, + * which would lead to incorrect calculations. + * + * This function returns the timezone offset in milliseconds that takes seconds in account. + */ +export default function getTimezoneOffsetInMilliseconds(date) { + var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds())); + utcDate.setUTCFullYear(date.getFullYear()); + return date.getTime() - utcDate.getTime(); +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js b/node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js new file mode 100644 index 0000000..39ea54d --- /dev/null +++ b/node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js @@ -0,0 +1,13 @@ +import toDate from "../../toDate/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +var MILLISECONDS_IN_DAY = 86400000; +export default function getUTCDayOfYear(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var timestamp = date.getTime(); + date.setUTCMonth(0, 1); + date.setUTCHours(0, 0, 0, 0); + var startOfYearTimestamp = date.getTime(); + var difference = timestamp - startOfYearTimestamp; + return Math.floor(difference / MILLISECONDS_IN_DAY) + 1; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js b/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js new file mode 100644 index 0000000..048844a --- /dev/null +++ b/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js @@ -0,0 +1,15 @@ +import toDate from "../../toDate/index.js"; +import startOfUTCISOWeek from "../startOfUTCISOWeek/index.js"; +import startOfUTCISOWeekYear from "../startOfUTCISOWeekYear/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +var MILLISECONDS_IN_WEEK = 604800000; +export default function getUTCISOWeek(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); + + // Round the number of days to the nearest integer + // because the number of milliseconds in a week is not constant + // (e.g. it's different in the week of the daylight saving time clock shift) + return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js b/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js new file mode 100644 index 0000000..f997463 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js @@ -0,0 +1,23 @@ +import toDate from "../../toDate/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +import startOfUTCISOWeek from "../startOfUTCISOWeek/index.js"; +export default function getUTCISOWeekYear(dirtyDate) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var year = date.getUTCFullYear(); + var fourthOfJanuaryOfNextYear = new Date(0); + fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4); + fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0); + var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear); + var fourthOfJanuaryOfThisYear = new Date(0); + fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4); + fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0); + var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear); + if (date.getTime() >= startOfNextYear.getTime()) { + return year + 1; + } else if (date.getTime() >= startOfThisYear.getTime()) { + return year; + } else { + return year - 1; + } +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/getUTCWeek/index.js b/node_modules/date-fns/esm/_lib/getUTCWeek/index.js new file mode 100644 index 0000000..8cfbc10 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/getUTCWeek/index.js @@ -0,0 +1,15 @@ +import toDate from "../../toDate/index.js"; +import startOfUTCWeek from "../startOfUTCWeek/index.js"; +import startOfUTCWeekYear from "../startOfUTCWeekYear/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +var MILLISECONDS_IN_WEEK = 604800000; +export default function getUTCWeek(dirtyDate, options) { + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); + + // Round the number of days to the nearest integer + // because the number of milliseconds in a week is not constant + // (e.g. it's different in the week of the daylight saving time clock shift) + return Math.round(diff / MILLISECONDS_IN_WEEK) + 1; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js b/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js new file mode 100644 index 0000000..7c70a47 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js @@ -0,0 +1,33 @@ +import toDate from "../../toDate/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +import startOfUTCWeek from "../startOfUTCWeek/index.js"; +import toInteger from "../toInteger/index.js"; +import { getDefaultOptions } from "../defaultOptions/index.js"; +export default function getUTCWeekYear(dirtyDate, options) { + var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; + requiredArgs(1, arguments); + var date = toDate(dirtyDate); + var year = date.getUTCFullYear(); + var defaultOptions = getDefaultOptions(); + var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); + + // Test if weekStartsOn is between 1 and 7 _and_ is not NaN + if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) { + throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively'); + } + var firstWeekOfNextYear = new Date(0); + firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate); + firstWeekOfNextYear.setUTCHours(0, 0, 0, 0); + var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options); + var firstWeekOfThisYear = new Date(0); + firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate); + firstWeekOfThisYear.setUTCHours(0, 0, 0, 0); + var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options); + if (date.getTime() >= startOfNextYear.getTime()) { + return year + 1; + } else if (date.getTime() >= startOfThisYear.getTime()) { + return year; + } else { + return year - 1; + } +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/isSameUTCWeek/index.js b/node_modules/date-fns/esm/_lib/isSameUTCWeek/index.js new file mode 100644 index 0000000..21a6ba3 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/isSameUTCWeek/index.js @@ -0,0 +1,8 @@ +import requiredArgs from "../requiredArgs/index.js"; +import startOfUTCWeek from "../startOfUTCWeek/index.js"; +export default function isSameUTCWeek(dirtyDateLeft, dirtyDateRight, options) { + requiredArgs(2, arguments); + var dateLeftStartOfWeek = startOfUTCWeek(dirtyDateLeft, options); + var dateRightStartOfWeek = startOfUTCWeek(dirtyDateRight, options); + return dateLeftStartOfWeek.getTime() === dateRightStartOfWeek.getTime(); +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/protectedTokens/index.js b/node_modules/date-fns/esm/_lib/protectedTokens/index.js new file mode 100644 index 0000000..e241fce --- /dev/null +++ b/node_modules/date-fns/esm/_lib/protectedTokens/index.js @@ -0,0 +1,19 @@ +var protectedDayOfYearTokens = ['D', 'DD']; +var protectedWeekYearTokens = ['YY', 'YYYY']; +export function isProtectedDayOfYearToken(token) { + return protectedDayOfYearTokens.indexOf(token) !== -1; +} +export function isProtectedWeekYearToken(token) { + return protectedWeekYearTokens.indexOf(token) !== -1; +} +export function throwProtectedError(token, format, input) { + if (token === 'YYYY') { + throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); + } else if (token === 'YY') { + throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); + } else if (token === 'D') { + throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); + } else if (token === 'DD') { + throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md")); + } +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/requiredArgs/index.js b/node_modules/date-fns/esm/_lib/requiredArgs/index.js new file mode 100644 index 0000000..46d9179 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/requiredArgs/index.js @@ -0,0 +1,5 @@ +export default function requiredArgs(required, args) { + if (args.length < required) { + throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present'); + } +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/roundingMethods/index.js b/node_modules/date-fns/esm/_lib/roundingMethods/index.js new file mode 100644 index 0000000..2791267 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/roundingMethods/index.js @@ -0,0 +1,13 @@ +var roundingMap = { + ceil: Math.ceil, + round: Math.round, + floor: Math.floor, + trunc: function trunc(value) { + return value < 0 ? Math.ceil(value) : Math.floor(value); + } // Math.trunc is not supported by IE +}; + +var defaultRoundingMethod = 'trunc'; +export function getRoundingMethod(method) { + return method ? roundingMap[method] : roundingMap[defaultRoundingMethod]; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/setUTCDay/index.js b/node_modules/date-fns/esm/_lib/setUTCDay/index.js new file mode 100644 index 0000000..3af6209 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/setUTCDay/index.js @@ -0,0 +1,23 @@ +import toDate from "../../toDate/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +import toInteger from "../toInteger/index.js"; +import { getDefaultOptions } from "../defaultOptions/index.js"; +export default function setUTCDay(dirtyDate, dirtyDay, options) { + var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; + requiredArgs(2, arguments); + var defaultOptions = getDefaultOptions(); + var weekStartsOn = toInteger((_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 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); + + // Test if weekStartsOn is between 0 and 6 _and_ is not NaN + if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { + throw new RangeError('weekStartsOn must be between 0 and 6 inclusively'); + } + var date = toDate(dirtyDate); + var day = toInteger(dirtyDay); + var currentDay = date.getUTCDay(); + var remainder = day % 7; + var dayIndex = (remainder + 7) % 7; + var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay; + date.setUTCDate(date.getUTCDate() + diff); + return date; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/setUTCISODay/index.js b/node_modules/date-fns/esm/_lib/setUTCISODay/index.js new file mode 100644 index 0000000..36f8568 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/setUTCISODay/index.js @@ -0,0 +1,18 @@ +import toDate from "../../toDate/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +import toInteger from "../toInteger/index.js"; +export default function setUTCISODay(dirtyDate, dirtyDay) { + requiredArgs(2, arguments); + var day = toInteger(dirtyDay); + if (day % 7 === 0) { + day = day - 7; + } + var weekStartsOn = 1; + var date = toDate(dirtyDate); + var currentDay = date.getUTCDay(); + var remainder = day % 7; + var dayIndex = (remainder + 7) % 7; + var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay; + date.setUTCDate(date.getUTCDate() + diff); + return date; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js b/node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js new file mode 100644 index 0000000..a54ae34 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js @@ -0,0 +1,12 @@ +import toInteger from "../toInteger/index.js"; +import toDate from "../../toDate/index.js"; +import getUTCISOWeek from "../getUTCISOWeek/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +export default function setUTCISOWeek(dirtyDate, dirtyISOWeek) { + requiredArgs(2, arguments); + var date = toDate(dirtyDate); + var isoWeek = toInteger(dirtyISOWeek); + var diff = getUTCISOWeek(date) - isoWeek; + date.setUTCDate(date.getUTCDate() - diff * 7); + return date; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/setUTCWeek/index.js b/node_modules/date-fns/esm/_lib/setUTCWeek/index.js new file mode 100644 index 0000000..a3a430d --- /dev/null +++ b/node_modules/date-fns/esm/_lib/setUTCWeek/index.js @@ -0,0 +1,12 @@ +import toInteger from "../toInteger/index.js"; +import toDate from "../../toDate/index.js"; +import getUTCWeek from "../getUTCWeek/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +export default function setUTCWeek(dirtyDate, dirtyWeek, options) { + requiredArgs(2, arguments); + var date = toDate(dirtyDate); + var week = toInteger(dirtyWeek); + var diff = getUTCWeek(date, options) - week; + date.setUTCDate(date.getUTCDate() - diff * 7); + return date; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js b/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js new file mode 100644 index 0000000..ecd39d9 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js @@ -0,0 +1,12 @@ +import toDate from "../../toDate/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +export default function startOfUTCISOWeek(dirtyDate) { + requiredArgs(1, arguments); + var weekStartsOn = 1; + var date = toDate(dirtyDate); + var day = date.getUTCDay(); + var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; + date.setUTCDate(date.getUTCDate() - diff); + date.setUTCHours(0, 0, 0, 0); + return date; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js b/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js new file mode 100644 index 0000000..66d6fae --- /dev/null +++ b/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js @@ -0,0 +1,12 @@ +import getUTCISOWeekYear from "../getUTCISOWeekYear/index.js"; +import startOfUTCISOWeek from "../startOfUTCISOWeek/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +export default function startOfUTCISOWeekYear(dirtyDate) { + requiredArgs(1, arguments); + var year = getUTCISOWeekYear(dirtyDate); + var fourthOfJanuary = new Date(0); + fourthOfJanuary.setUTCFullYear(year, 0, 4); + fourthOfJanuary.setUTCHours(0, 0, 0, 0); + var date = startOfUTCISOWeek(fourthOfJanuary); + return date; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js b/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js new file mode 100644 index 0000000..31404c2 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js @@ -0,0 +1,21 @@ +import toDate from "../../toDate/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +import toInteger from "../toInteger/index.js"; +import { getDefaultOptions } from "../defaultOptions/index.js"; +export default function startOfUTCWeek(dirtyDate, options) { + var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; + requiredArgs(1, arguments); + var defaultOptions = getDefaultOptions(); + var weekStartsOn = toInteger((_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 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); + + // Test if weekStartsOn is between 0 and 6 _and_ is not NaN + if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) { + throw new RangeError('weekStartsOn must be between 0 and 6 inclusively'); + } + var date = toDate(dirtyDate); + var day = date.getUTCDay(); + var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; + date.setUTCDate(date.getUTCDate() - diff); + date.setUTCHours(0, 0, 0, 0); + return date; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js b/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js new file mode 100644 index 0000000..3dd7160 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js @@ -0,0 +1,17 @@ +import getUTCWeekYear from "../getUTCWeekYear/index.js"; +import requiredArgs from "../requiredArgs/index.js"; +import startOfUTCWeek from "../startOfUTCWeek/index.js"; +import toInteger from "../toInteger/index.js"; +import { getDefaultOptions } from "../defaultOptions/index.js"; +export default function startOfUTCWeekYear(dirtyDate, options) { + var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2; + requiredArgs(1, arguments); + var defaultOptions = getDefaultOptions(); + var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); + var year = getUTCWeekYear(dirtyDate, options); + var firstWeek = new Date(0); + firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate); + firstWeek.setUTCHours(0, 0, 0, 0); + var date = startOfUTCWeek(firstWeek, options); + return date; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/test/index.js b/node_modules/date-fns/esm/_lib/test/index.js new file mode 100644 index 0000000..6193684 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/test/index.js @@ -0,0 +1,24 @@ +import addLeadingZeros from "../addLeadingZeros/index.js"; +import { setDefaultOptions } from "../defaultOptions/index.js"; +export function assertType(_) {} +export function resetDefaultOptions() { + setDefaultOptions({}); +} + +// This makes sure we create the consistent offsets across timezones, no matter where these tests are ran. +export function generateOffset(originalDate) { + // Add the timezone. + var offset = ''; + var tzOffset = originalDate.getTimezoneOffset(); + if (tzOffset !== 0) { + var absoluteOffset = Math.abs(tzOffset); + var hourOffset = addLeadingZeros(Math.floor(absoluteOffset / 60), 2); + var minuteOffset = addLeadingZeros(absoluteOffset % 60, 2); + // If less than 0, the sign is +, because it is ahead of time. + var sign = tzOffset < 0 ? '+' : '-'; + offset = "".concat(sign).concat(hourOffset, ":").concat(minuteOffset); + } else { + offset = 'Z'; + } + return offset; +} \ No newline at end of file diff --git a/node_modules/date-fns/esm/_lib/toInteger/index.js b/node_modules/date-fns/esm/_lib/toInteger/index.js new file mode 100644 index 0000000..7809a87 --- /dev/null +++ b/node_modules/date-fns/esm/_lib/toInteger/index.js @@ -0,0 +1,10 @@ +export default function toInteger(dirtyNumber) { + if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) { + return NaN; + } + var number = Number(dirtyNumber); + if (isNaN(number)) { + return number; + } + return number < 0 ? Math.ceil(number) : Math.floor(number); +} \ No newline at end of file -- cgit v1.2.3