- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
6059 lines
179 KiB
JavaScript
6059 lines
179 KiB
JavaScript
import {
|
|
__publicField
|
|
} from "./chunk-4B2QHNJT.js";
|
|
|
|
// ../../node_modules/date-fns/toDate.mjs
|
|
function toDate(argument) {
|
|
const argStr = Object.prototype.toString.call(argument);
|
|
if (argument instanceof Date || typeof argument === "object" && argStr === "[object Date]") {
|
|
return new argument.constructor(+argument);
|
|
} else if (typeof argument === "number" || argStr === "[object Number]" || typeof argument === "string" || argStr === "[object String]") {
|
|
return new Date(argument);
|
|
} else {
|
|
return /* @__PURE__ */ new Date(NaN);
|
|
}
|
|
}
|
|
|
|
// ../../node_modules/date-fns/constructFrom.mjs
|
|
function constructFrom(date, value) {
|
|
if (date instanceof Date) {
|
|
return new date.constructor(value);
|
|
} else {
|
|
return new Date(value);
|
|
}
|
|
}
|
|
|
|
// ../../node_modules/date-fns/addDays.mjs
|
|
function addDays(date, amount) {
|
|
const _date = toDate(date);
|
|
if (isNaN(amount)) return constructFrom(date, NaN);
|
|
if (!amount) {
|
|
return _date;
|
|
}
|
|
_date.setDate(_date.getDate() + amount);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/addMonths.mjs
|
|
function addMonths(date, amount) {
|
|
const _date = toDate(date);
|
|
if (isNaN(amount)) return constructFrom(date, NaN);
|
|
if (!amount) {
|
|
return _date;
|
|
}
|
|
const dayOfMonth = _date.getDate();
|
|
const endOfDesiredMonth = constructFrom(date, _date.getTime());
|
|
endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
|
|
const daysInMonth = endOfDesiredMonth.getDate();
|
|
if (dayOfMonth >= daysInMonth) {
|
|
return endOfDesiredMonth;
|
|
} else {
|
|
_date.setFullYear(
|
|
endOfDesiredMonth.getFullYear(),
|
|
endOfDesiredMonth.getMonth(),
|
|
dayOfMonth
|
|
);
|
|
return _date;
|
|
}
|
|
}
|
|
|
|
// ../../node_modules/date-fns/add.mjs
|
|
function add(date, duration) {
|
|
const {
|
|
years = 0,
|
|
months: months2 = 0,
|
|
weeks = 0,
|
|
days: days2 = 0,
|
|
hours = 0,
|
|
minutes = 0,
|
|
seconds = 0
|
|
} = duration;
|
|
const _date = toDate(date);
|
|
const dateWithMonths = months2 || years ? addMonths(_date, months2 + years * 12) : _date;
|
|
const dateWithDays = days2 || weeks ? addDays(dateWithMonths, days2 + weeks * 7) : dateWithMonths;
|
|
const minutesToAdd = minutes + hours * 60;
|
|
const secondsToAdd = seconds + minutesToAdd * 60;
|
|
const msToAdd = secondsToAdd * 1e3;
|
|
const finalDate = constructFrom(date, dateWithDays.getTime() + msToAdd);
|
|
return finalDate;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSaturday.mjs
|
|
function isSaturday(date) {
|
|
return toDate(date).getDay() === 6;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSunday.mjs
|
|
function isSunday(date) {
|
|
return toDate(date).getDay() === 0;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isWeekend.mjs
|
|
function isWeekend(date) {
|
|
const day = toDate(date).getDay();
|
|
return day === 0 || day === 6;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/addBusinessDays.mjs
|
|
function addBusinessDays(date, amount) {
|
|
const _date = toDate(date);
|
|
const startedOnWeekend = isWeekend(_date);
|
|
if (isNaN(amount)) return constructFrom(date, NaN);
|
|
const hours = _date.getHours();
|
|
const sign = amount < 0 ? -1 : 1;
|
|
const fullWeeks = Math.trunc(amount / 5);
|
|
_date.setDate(_date.getDate() + fullWeeks * 7);
|
|
let restDays = Math.abs(amount % 5);
|
|
while (restDays > 0) {
|
|
_date.setDate(_date.getDate() + sign);
|
|
if (!isWeekend(_date)) restDays -= 1;
|
|
}
|
|
if (startedOnWeekend && isWeekend(_date) && amount !== 0) {
|
|
if (isSaturday(_date)) _date.setDate(_date.getDate() + (sign < 0 ? 2 : -1));
|
|
if (isSunday(_date)) _date.setDate(_date.getDate() + (sign < 0 ? 1 : -2));
|
|
}
|
|
_date.setHours(hours);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/addMilliseconds.mjs
|
|
function addMilliseconds(date, amount) {
|
|
const timestamp = +toDate(date);
|
|
return constructFrom(date, timestamp + amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/constants.mjs
|
|
var daysInWeek = 7;
|
|
var daysInYear = 365.2425;
|
|
var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3;
|
|
var minTime = -maxTime;
|
|
var millisecondsInWeek = 6048e5;
|
|
var millisecondsInDay = 864e5;
|
|
var millisecondsInMinute = 6e4;
|
|
var millisecondsInHour = 36e5;
|
|
var millisecondsInSecond = 1e3;
|
|
var minutesInYear = 525600;
|
|
var minutesInMonth = 43200;
|
|
var minutesInDay = 1440;
|
|
var minutesInHour = 60;
|
|
var monthsInQuarter = 3;
|
|
var monthsInYear = 12;
|
|
var quartersInYear = 4;
|
|
var secondsInHour = 3600;
|
|
var secondsInMinute = 60;
|
|
var secondsInDay = secondsInHour * 24;
|
|
var secondsInWeek = secondsInDay * 7;
|
|
var secondsInYear = secondsInDay * daysInYear;
|
|
var secondsInMonth = secondsInYear / 12;
|
|
var secondsInQuarter = secondsInMonth * 3;
|
|
|
|
// ../../node_modules/date-fns/addHours.mjs
|
|
function addHours(date, amount) {
|
|
return addMilliseconds(date, amount * millisecondsInHour);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/_lib/defaultOptions.mjs
|
|
var defaultOptions = {};
|
|
function getDefaultOptions() {
|
|
return defaultOptions;
|
|
}
|
|
function setDefaultOptions(newOptions) {
|
|
defaultOptions = newOptions;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfWeek.mjs
|
|
function startOfWeek(date, options) {
|
|
var _a, _b, _c, _d;
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
|
const _date = toDate(date);
|
|
const day = _date.getDay();
|
|
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
|
_date.setDate(_date.getDate() - diff);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfISOWeek.mjs
|
|
function startOfISOWeek(date) {
|
|
return startOfWeek(date, { weekStartsOn: 1 });
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getISOWeekYear.mjs
|
|
function getISOWeekYear(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
const fourthOfJanuaryOfNextYear = constructFrom(date, 0);
|
|
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
|
const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
|
|
const fourthOfJanuaryOfThisYear = constructFrom(date, 0);
|
|
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
|
|
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
|
|
const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
|
|
if (_date.getTime() >= startOfNextYear.getTime()) {
|
|
return year + 1;
|
|
} else if (_date.getTime() >= startOfThisYear.getTime()) {
|
|
return year;
|
|
} else {
|
|
return year - 1;
|
|
}
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfDay.mjs
|
|
function startOfDay(date) {
|
|
const _date = toDate(date);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.mjs
|
|
function getTimezoneOffsetInMilliseconds(date) {
|
|
const _date = toDate(date);
|
|
const 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 - +utcDate;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInCalendarDays.mjs
|
|
function differenceInCalendarDays(dateLeft, dateRight) {
|
|
const startOfDayLeft = startOfDay(dateLeft);
|
|
const startOfDayRight = startOfDay(dateRight);
|
|
const timestampLeft = +startOfDayLeft - getTimezoneOffsetInMilliseconds(startOfDayLeft);
|
|
const timestampRight = +startOfDayRight - getTimezoneOffsetInMilliseconds(startOfDayRight);
|
|
return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfISOWeekYear.mjs
|
|
function startOfISOWeekYear(date) {
|
|
const year = getISOWeekYear(date);
|
|
const fourthOfJanuary = constructFrom(date, 0);
|
|
fourthOfJanuary.setFullYear(year, 0, 4);
|
|
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
return startOfISOWeek(fourthOfJanuary);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setISOWeekYear.mjs
|
|
function setISOWeekYear(date, weekYear) {
|
|
let _date = toDate(date);
|
|
const diff = differenceInCalendarDays(_date, startOfISOWeekYear(_date));
|
|
const fourthOfJanuary = constructFrom(date, 0);
|
|
fourthOfJanuary.setFullYear(weekYear, 0, 4);
|
|
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
_date = startOfISOWeekYear(fourthOfJanuary);
|
|
_date.setDate(_date.getDate() + diff);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/addISOWeekYears.mjs
|
|
function addISOWeekYears(date, amount) {
|
|
return setISOWeekYear(date, getISOWeekYear(date) + amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/addMinutes.mjs
|
|
function addMinutes(date, amount) {
|
|
return addMilliseconds(date, amount * millisecondsInMinute);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/addQuarters.mjs
|
|
function addQuarters(date, amount) {
|
|
const months2 = amount * 3;
|
|
return addMonths(date, months2);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/addSeconds.mjs
|
|
function addSeconds(date, amount) {
|
|
return addMilliseconds(date, amount * 1e3);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/addWeeks.mjs
|
|
function addWeeks(date, amount) {
|
|
const days2 = amount * 7;
|
|
return addDays(date, days2);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/addYears.mjs
|
|
function addYears(date, amount) {
|
|
return addMonths(date, amount * 12);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/areIntervalsOverlapping.mjs
|
|
function areIntervalsOverlapping(intervalLeft, intervalRight, options) {
|
|
const [leftStartTime, leftEndTime] = [
|
|
+toDate(intervalLeft.start),
|
|
+toDate(intervalLeft.end)
|
|
].sort((a, b) => a - b);
|
|
const [rightStartTime, rightEndTime] = [
|
|
+toDate(intervalRight.start),
|
|
+toDate(intervalRight.end)
|
|
].sort((a, b) => a - b);
|
|
if (options == null ? void 0 : options.inclusive)
|
|
return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime;
|
|
return leftStartTime < rightEndTime && rightStartTime < leftEndTime;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/max.mjs
|
|
function max(dates) {
|
|
let result;
|
|
dates.forEach(function(dirtyDate) {
|
|
const currentDate = toDate(dirtyDate);
|
|
if (result === void 0 || result < currentDate || isNaN(Number(currentDate))) {
|
|
result = currentDate;
|
|
}
|
|
});
|
|
return result || /* @__PURE__ */ new Date(NaN);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/min.mjs
|
|
function min(dates) {
|
|
let result;
|
|
dates.forEach((dirtyDate) => {
|
|
const date = toDate(dirtyDate);
|
|
if (!result || result > date || isNaN(+date)) {
|
|
result = date;
|
|
}
|
|
});
|
|
return result || /* @__PURE__ */ new Date(NaN);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/clamp.mjs
|
|
function clamp(date, interval2) {
|
|
return min([max([date, interval2.start]), interval2.end]);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/closestIndexTo.mjs
|
|
function closestIndexTo(dateToCompare, dates) {
|
|
const date = toDate(dateToCompare);
|
|
if (isNaN(Number(date))) return NaN;
|
|
const timeToCompare = date.getTime();
|
|
let result;
|
|
let minDistance;
|
|
dates.forEach(function(dirtyDate, index) {
|
|
const currentDate = toDate(dirtyDate);
|
|
if (isNaN(Number(currentDate))) {
|
|
result = NaN;
|
|
minDistance = NaN;
|
|
return;
|
|
}
|
|
const distance = Math.abs(timeToCompare - currentDate.getTime());
|
|
if (result == null || distance < minDistance) {
|
|
result = index;
|
|
minDistance = distance;
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/closestTo.mjs
|
|
function closestTo(dateToCompare, dates) {
|
|
const date = toDate(dateToCompare);
|
|
if (isNaN(Number(date))) return constructFrom(dateToCompare, NaN);
|
|
const timeToCompare = date.getTime();
|
|
let result;
|
|
let minDistance;
|
|
dates.forEach((dirtyDate) => {
|
|
const currentDate = toDate(dirtyDate);
|
|
if (isNaN(Number(currentDate))) {
|
|
result = constructFrom(dateToCompare, NaN);
|
|
minDistance = NaN;
|
|
return;
|
|
}
|
|
const distance = Math.abs(timeToCompare - currentDate.getTime());
|
|
if (result == null || distance < minDistance) {
|
|
result = currentDate;
|
|
minDistance = distance;
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/compareAsc.mjs
|
|
function compareAsc(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
const diff = _dateLeft.getTime() - _dateRight.getTime();
|
|
if (diff < 0) {
|
|
return -1;
|
|
} else if (diff > 0) {
|
|
return 1;
|
|
} else {
|
|
return diff;
|
|
}
|
|
}
|
|
|
|
// ../../node_modules/date-fns/compareDesc.mjs
|
|
function compareDesc(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
const diff = _dateLeft.getTime() - _dateRight.getTime();
|
|
if (diff > 0) {
|
|
return -1;
|
|
} else if (diff < 0) {
|
|
return 1;
|
|
} else {
|
|
return diff;
|
|
}
|
|
}
|
|
|
|
// ../../node_modules/date-fns/constructNow.mjs
|
|
function constructNow(date) {
|
|
return constructFrom(date, Date.now());
|
|
}
|
|
|
|
// ../../node_modules/date-fns/daysToWeeks.mjs
|
|
function daysToWeeks(days2) {
|
|
const weeks = days2 / daysInWeek;
|
|
const result = Math.trunc(weeks);
|
|
return result === 0 ? 0 : result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSameDay.mjs
|
|
function isSameDay(dateLeft, dateRight) {
|
|
const dateLeftStartOfDay = startOfDay(dateLeft);
|
|
const dateRightStartOfDay = startOfDay(dateRight);
|
|
return +dateLeftStartOfDay === +dateRightStartOfDay;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isDate.mjs
|
|
function isDate(value) {
|
|
return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isValid.mjs
|
|
function isValid(date) {
|
|
if (!isDate(date) && typeof date !== "number") {
|
|
return false;
|
|
}
|
|
const _date = toDate(date);
|
|
return !isNaN(Number(_date));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInBusinessDays.mjs
|
|
function differenceInBusinessDays(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
let _dateRight = toDate(dateRight);
|
|
if (!isValid(_dateLeft) || !isValid(_dateRight)) return NaN;
|
|
const calendarDifference = differenceInCalendarDays(_dateLeft, _dateRight);
|
|
const sign = calendarDifference < 0 ? -1 : 1;
|
|
const weeks = Math.trunc(calendarDifference / 7);
|
|
let result = weeks * 5;
|
|
_dateRight = addDays(_dateRight, weeks * 7);
|
|
while (!isSameDay(_dateLeft, _dateRight)) {
|
|
result += isWeekend(_dateRight) ? 0 : sign;
|
|
_dateRight = addDays(_dateRight, sign);
|
|
}
|
|
return result === 0 ? 0 : result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInCalendarISOWeekYears.mjs
|
|
function differenceInCalendarISOWeekYears(dateLeft, dateRight) {
|
|
return getISOWeekYear(dateLeft) - getISOWeekYear(dateRight);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInCalendarISOWeeks.mjs
|
|
function differenceInCalendarISOWeeks(dateLeft, dateRight) {
|
|
const startOfISOWeekLeft = startOfISOWeek(dateLeft);
|
|
const startOfISOWeekRight = startOfISOWeek(dateRight);
|
|
const timestampLeft = +startOfISOWeekLeft - getTimezoneOffsetInMilliseconds(startOfISOWeekLeft);
|
|
const timestampRight = +startOfISOWeekRight - getTimezoneOffsetInMilliseconds(startOfISOWeekRight);
|
|
return Math.round((timestampLeft - timestampRight) / millisecondsInWeek);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInCalendarMonths.mjs
|
|
function differenceInCalendarMonths(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
const yearDiff = _dateLeft.getFullYear() - _dateRight.getFullYear();
|
|
const monthDiff = _dateLeft.getMonth() - _dateRight.getMonth();
|
|
return yearDiff * 12 + monthDiff;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getQuarter.mjs
|
|
function getQuarter(date) {
|
|
const _date = toDate(date);
|
|
const quarter = Math.trunc(_date.getMonth() / 3) + 1;
|
|
return quarter;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInCalendarQuarters.mjs
|
|
function differenceInCalendarQuarters(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
const yearDiff = _dateLeft.getFullYear() - _dateRight.getFullYear();
|
|
const quarterDiff = getQuarter(_dateLeft) - getQuarter(_dateRight);
|
|
return yearDiff * 4 + quarterDiff;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInCalendarWeeks.mjs
|
|
function differenceInCalendarWeeks(dateLeft, dateRight, options) {
|
|
const startOfWeekLeft = startOfWeek(dateLeft, options);
|
|
const startOfWeekRight = startOfWeek(dateRight, options);
|
|
const timestampLeft = +startOfWeekLeft - getTimezoneOffsetInMilliseconds(startOfWeekLeft);
|
|
const timestampRight = +startOfWeekRight - getTimezoneOffsetInMilliseconds(startOfWeekRight);
|
|
return Math.round((timestampLeft - timestampRight) / millisecondsInWeek);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInCalendarYears.mjs
|
|
function differenceInCalendarYears(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
return _dateLeft.getFullYear() - _dateRight.getFullYear();
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInDays.mjs
|
|
function differenceInDays(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
const sign = compareLocalAsc(_dateLeft, _dateRight);
|
|
const difference = Math.abs(differenceInCalendarDays(_dateLeft, _dateRight));
|
|
_dateLeft.setDate(_dateLeft.getDate() - sign * difference);
|
|
const isLastDayNotFull = Number(
|
|
compareLocalAsc(_dateLeft, _dateRight) === -sign
|
|
);
|
|
const result = sign * (difference - isLastDayNotFull);
|
|
return result === 0 ? 0 : result;
|
|
}
|
|
function compareLocalAsc(dateLeft, dateRight) {
|
|
const diff = dateLeft.getFullYear() - dateRight.getFullYear() || dateLeft.getMonth() - dateRight.getMonth() || dateLeft.getDate() - dateRight.getDate() || dateLeft.getHours() - dateRight.getHours() || dateLeft.getMinutes() - dateRight.getMinutes() || dateLeft.getSeconds() - dateRight.getSeconds() || dateLeft.getMilliseconds() - dateRight.getMilliseconds();
|
|
if (diff < 0) {
|
|
return -1;
|
|
} else if (diff > 0) {
|
|
return 1;
|
|
} else {
|
|
return diff;
|
|
}
|
|
}
|
|
|
|
// ../../node_modules/date-fns/_lib/getRoundingMethod.mjs
|
|
function getRoundingMethod(method) {
|
|
return (number) => {
|
|
const round = method ? Math[method] : Math.trunc;
|
|
const result = round(number);
|
|
return result === 0 ? 0 : result;
|
|
};
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInMilliseconds.mjs
|
|
function differenceInMilliseconds(dateLeft, dateRight) {
|
|
return +toDate(dateLeft) - +toDate(dateRight);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInHours.mjs
|
|
function differenceInHours(dateLeft, dateRight, options) {
|
|
const diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInHour;
|
|
return getRoundingMethod(options == null ? void 0 : options.roundingMethod)(diff);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subISOWeekYears.mjs
|
|
function subISOWeekYears(date, amount) {
|
|
return addISOWeekYears(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInISOWeekYears.mjs
|
|
function differenceInISOWeekYears(dateLeft, dateRight) {
|
|
let _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
const sign = compareAsc(_dateLeft, _dateRight);
|
|
const difference = Math.abs(
|
|
differenceInCalendarISOWeekYears(_dateLeft, _dateRight)
|
|
);
|
|
_dateLeft = subISOWeekYears(_dateLeft, sign * difference);
|
|
const isLastISOWeekYearNotFull = Number(
|
|
compareAsc(_dateLeft, _dateRight) === -sign
|
|
);
|
|
const result = sign * (difference - isLastISOWeekYearNotFull);
|
|
return result === 0 ? 0 : result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInMinutes.mjs
|
|
function differenceInMinutes(dateLeft, dateRight, options) {
|
|
const diff = differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;
|
|
return getRoundingMethod(options == null ? void 0 : options.roundingMethod)(diff);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfDay.mjs
|
|
function endOfDay(date) {
|
|
const _date = toDate(date);
|
|
_date.setHours(23, 59, 59, 999);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfMonth.mjs
|
|
function endOfMonth(date) {
|
|
const _date = toDate(date);
|
|
const month = _date.getMonth();
|
|
_date.setFullYear(_date.getFullYear(), month + 1, 0);
|
|
_date.setHours(23, 59, 59, 999);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isLastDayOfMonth.mjs
|
|
function isLastDayOfMonth(date) {
|
|
const _date = toDate(date);
|
|
return +endOfDay(_date) === +endOfMonth(_date);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInMonths.mjs
|
|
function differenceInMonths(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
const sign = compareAsc(_dateLeft, _dateRight);
|
|
const difference = Math.abs(
|
|
differenceInCalendarMonths(_dateLeft, _dateRight)
|
|
);
|
|
let result;
|
|
if (difference < 1) {
|
|
result = 0;
|
|
} else {
|
|
if (_dateLeft.getMonth() === 1 && _dateLeft.getDate() > 27) {
|
|
_dateLeft.setDate(30);
|
|
}
|
|
_dateLeft.setMonth(_dateLeft.getMonth() - sign * difference);
|
|
let isLastMonthNotFull = compareAsc(_dateLeft, _dateRight) === -sign;
|
|
if (isLastDayOfMonth(toDate(dateLeft)) && difference === 1 && compareAsc(dateLeft, _dateRight) === 1) {
|
|
isLastMonthNotFull = false;
|
|
}
|
|
result = sign * (difference - Number(isLastMonthNotFull));
|
|
}
|
|
return result === 0 ? 0 : result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInQuarters.mjs
|
|
function differenceInQuarters(dateLeft, dateRight, options) {
|
|
const diff = differenceInMonths(dateLeft, dateRight) / 3;
|
|
return getRoundingMethod(options == null ? void 0 : options.roundingMethod)(diff);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInSeconds.mjs
|
|
function differenceInSeconds(dateLeft, dateRight, options) {
|
|
const diff = differenceInMilliseconds(dateLeft, dateRight) / 1e3;
|
|
return getRoundingMethod(options == null ? void 0 : options.roundingMethod)(diff);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInWeeks.mjs
|
|
function differenceInWeeks(dateLeft, dateRight, options) {
|
|
const diff = differenceInDays(dateLeft, dateRight) / 7;
|
|
return getRoundingMethod(options == null ? void 0 : options.roundingMethod)(diff);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/differenceInYears.mjs
|
|
function differenceInYears(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
const sign = compareAsc(_dateLeft, _dateRight);
|
|
const difference = Math.abs(differenceInCalendarYears(_dateLeft, _dateRight));
|
|
_dateLeft.setFullYear(1584);
|
|
_dateRight.setFullYear(1584);
|
|
const isLastYearNotFull = compareAsc(_dateLeft, _dateRight) === -sign;
|
|
const result = sign * (difference - +isLastYearNotFull);
|
|
return result === 0 ? 0 : result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/eachDayOfInterval.mjs
|
|
function eachDayOfInterval(interval2, options) {
|
|
const startDate = toDate(interval2.start);
|
|
const endDate = toDate(interval2.end);
|
|
let reversed = +startDate > +endDate;
|
|
const endTime = reversed ? +startDate : +endDate;
|
|
const currentDate = reversed ? endDate : startDate;
|
|
currentDate.setHours(0, 0, 0, 0);
|
|
let step = (options == null ? void 0 : options.step) ?? 1;
|
|
if (!step) return [];
|
|
if (step < 0) {
|
|
step = -step;
|
|
reversed = !reversed;
|
|
}
|
|
const dates = [];
|
|
while (+currentDate <= endTime) {
|
|
dates.push(toDate(currentDate));
|
|
currentDate.setDate(currentDate.getDate() + step);
|
|
currentDate.setHours(0, 0, 0, 0);
|
|
}
|
|
return reversed ? dates.reverse() : dates;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/eachHourOfInterval.mjs
|
|
function eachHourOfInterval(interval2, options) {
|
|
const startDate = toDate(interval2.start);
|
|
const endDate = toDate(interval2.end);
|
|
let reversed = +startDate > +endDate;
|
|
const endTime = reversed ? +startDate : +endDate;
|
|
let currentDate = reversed ? endDate : startDate;
|
|
currentDate.setMinutes(0, 0, 0);
|
|
let step = (options == null ? void 0 : options.step) ?? 1;
|
|
if (!step) return [];
|
|
if (step < 0) {
|
|
step = -step;
|
|
reversed = !reversed;
|
|
}
|
|
const dates = [];
|
|
while (+currentDate <= endTime) {
|
|
dates.push(toDate(currentDate));
|
|
currentDate = addHours(currentDate, step);
|
|
}
|
|
return reversed ? dates.reverse() : dates;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfMinute.mjs
|
|
function startOfMinute(date) {
|
|
const _date = toDate(date);
|
|
_date.setSeconds(0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/eachMinuteOfInterval.mjs
|
|
function eachMinuteOfInterval(interval2, options) {
|
|
const startDate = startOfMinute(toDate(interval2.start));
|
|
const endDate = toDate(interval2.end);
|
|
let reversed = +startDate > +endDate;
|
|
const endTime = reversed ? +startDate : +endDate;
|
|
let currentDate = reversed ? endDate : startDate;
|
|
let step = (options == null ? void 0 : options.step) ?? 1;
|
|
if (!step) return [];
|
|
if (step < 0) {
|
|
step = -step;
|
|
reversed = !reversed;
|
|
}
|
|
const dates = [];
|
|
while (+currentDate <= endTime) {
|
|
dates.push(toDate(currentDate));
|
|
currentDate = addMinutes(currentDate, step);
|
|
}
|
|
return reversed ? dates.reverse() : dates;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/eachMonthOfInterval.mjs
|
|
function eachMonthOfInterval(interval2, options) {
|
|
const startDate = toDate(interval2.start);
|
|
const endDate = toDate(interval2.end);
|
|
let reversed = +startDate > +endDate;
|
|
const endTime = reversed ? +startDate : +endDate;
|
|
const currentDate = reversed ? endDate : startDate;
|
|
currentDate.setHours(0, 0, 0, 0);
|
|
currentDate.setDate(1);
|
|
let step = (options == null ? void 0 : options.step) ?? 1;
|
|
if (!step) return [];
|
|
if (step < 0) {
|
|
step = -step;
|
|
reversed = !reversed;
|
|
}
|
|
const dates = [];
|
|
while (+currentDate <= endTime) {
|
|
dates.push(toDate(currentDate));
|
|
currentDate.setMonth(currentDate.getMonth() + step);
|
|
}
|
|
return reversed ? dates.reverse() : dates;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfQuarter.mjs
|
|
function startOfQuarter(date) {
|
|
const _date = toDate(date);
|
|
const currentMonth = _date.getMonth();
|
|
const month = currentMonth - currentMonth % 3;
|
|
_date.setMonth(month, 1);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/eachQuarterOfInterval.mjs
|
|
function eachQuarterOfInterval(interval2, options) {
|
|
const startDate = toDate(interval2.start);
|
|
const endDate = toDate(interval2.end);
|
|
let reversed = +startDate > +endDate;
|
|
const endTime = reversed ? +startOfQuarter(startDate) : +startOfQuarter(endDate);
|
|
let currentDate = reversed ? startOfQuarter(endDate) : startOfQuarter(startDate);
|
|
let step = (options == null ? void 0 : options.step) ?? 1;
|
|
if (!step) return [];
|
|
if (step < 0) {
|
|
step = -step;
|
|
reversed = !reversed;
|
|
}
|
|
const dates = [];
|
|
while (+currentDate <= endTime) {
|
|
dates.push(toDate(currentDate));
|
|
currentDate = addQuarters(currentDate, step);
|
|
}
|
|
return reversed ? dates.reverse() : dates;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/eachWeekOfInterval.mjs
|
|
function eachWeekOfInterval(interval2, options) {
|
|
const startDate = toDate(interval2.start);
|
|
const endDate = toDate(interval2.end);
|
|
let reversed = +startDate > +endDate;
|
|
const startDateWeek = reversed ? startOfWeek(endDate, options) : startOfWeek(startDate, options);
|
|
const endDateWeek = reversed ? startOfWeek(startDate, options) : startOfWeek(endDate, options);
|
|
startDateWeek.setHours(15);
|
|
endDateWeek.setHours(15);
|
|
const endTime = +endDateWeek.getTime();
|
|
let currentDate = startDateWeek;
|
|
let step = (options == null ? void 0 : options.step) ?? 1;
|
|
if (!step) return [];
|
|
if (step < 0) {
|
|
step = -step;
|
|
reversed = !reversed;
|
|
}
|
|
const dates = [];
|
|
while (+currentDate <= endTime) {
|
|
currentDate.setHours(0);
|
|
dates.push(toDate(currentDate));
|
|
currentDate = addWeeks(currentDate, step);
|
|
currentDate.setHours(15);
|
|
}
|
|
return reversed ? dates.reverse() : dates;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/eachWeekendOfInterval.mjs
|
|
function eachWeekendOfInterval(interval2) {
|
|
const dateInterval = eachDayOfInterval(interval2);
|
|
const weekends = [];
|
|
let index = 0;
|
|
while (index < dateInterval.length) {
|
|
const date = dateInterval[index++];
|
|
if (isWeekend(date)) weekends.push(date);
|
|
}
|
|
return weekends;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfMonth.mjs
|
|
function startOfMonth(date) {
|
|
const _date = toDate(date);
|
|
_date.setDate(1);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/eachWeekendOfMonth.mjs
|
|
function eachWeekendOfMonth(date) {
|
|
const start = startOfMonth(date);
|
|
const end = endOfMonth(date);
|
|
return eachWeekendOfInterval({ start, end });
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfYear.mjs
|
|
function endOfYear(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
_date.setFullYear(year + 1, 0, 0);
|
|
_date.setHours(23, 59, 59, 999);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfYear.mjs
|
|
function startOfYear(date) {
|
|
const cleanDate = toDate(date);
|
|
const _date = constructFrom(date, 0);
|
|
_date.setFullYear(cleanDate.getFullYear(), 0, 1);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/eachWeekendOfYear.mjs
|
|
function eachWeekendOfYear(date) {
|
|
const start = startOfYear(date);
|
|
const end = endOfYear(date);
|
|
return eachWeekendOfInterval({ start, end });
|
|
}
|
|
|
|
// ../../node_modules/date-fns/eachYearOfInterval.mjs
|
|
function eachYearOfInterval(interval2, options) {
|
|
const startDate = toDate(interval2.start);
|
|
const endDate = toDate(interval2.end);
|
|
let reversed = +startDate > +endDate;
|
|
const endTime = reversed ? +startDate : +endDate;
|
|
const currentDate = reversed ? endDate : startDate;
|
|
currentDate.setHours(0, 0, 0, 0);
|
|
currentDate.setMonth(0, 1);
|
|
let step = (options == null ? void 0 : options.step) ?? 1;
|
|
if (!step) return [];
|
|
if (step < 0) {
|
|
step = -step;
|
|
reversed = !reversed;
|
|
}
|
|
const dates = [];
|
|
while (+currentDate <= endTime) {
|
|
dates.push(toDate(currentDate));
|
|
currentDate.setFullYear(currentDate.getFullYear() + step);
|
|
}
|
|
return reversed ? dates.reverse() : dates;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfDecade.mjs
|
|
function endOfDecade(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
const decade = 9 + Math.floor(year / 10) * 10;
|
|
_date.setFullYear(decade, 11, 31);
|
|
_date.setHours(23, 59, 59, 999);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfHour.mjs
|
|
function endOfHour(date) {
|
|
const _date = toDate(date);
|
|
_date.setMinutes(59, 59, 999);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfWeek.mjs
|
|
function endOfWeek(date, options) {
|
|
var _a, _b, _c, _d;
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
|
const _date = toDate(date);
|
|
const day = _date.getDay();
|
|
const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
|
|
_date.setDate(_date.getDate() + diff);
|
|
_date.setHours(23, 59, 59, 999);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfISOWeek.mjs
|
|
function endOfISOWeek(date) {
|
|
return endOfWeek(date, { weekStartsOn: 1 });
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfISOWeekYear.mjs
|
|
function endOfISOWeekYear(date) {
|
|
const year = getISOWeekYear(date);
|
|
const fourthOfJanuaryOfNextYear = constructFrom(date, 0);
|
|
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
|
const _date = startOfISOWeek(fourthOfJanuaryOfNextYear);
|
|
_date.setMilliseconds(_date.getMilliseconds() - 1);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfMinute.mjs
|
|
function endOfMinute(date) {
|
|
const _date = toDate(date);
|
|
_date.setSeconds(59, 999);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfQuarter.mjs
|
|
function endOfQuarter(date) {
|
|
const _date = toDate(date);
|
|
const currentMonth = _date.getMonth();
|
|
const month = currentMonth - currentMonth % 3 + 3;
|
|
_date.setMonth(month, 0);
|
|
_date.setHours(23, 59, 59, 999);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfSecond.mjs
|
|
function endOfSecond(date) {
|
|
const _date = toDate(date);
|
|
_date.setMilliseconds(999);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfToday.mjs
|
|
function endOfToday() {
|
|
return endOfDay(Date.now());
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfTomorrow.mjs
|
|
function endOfTomorrow() {
|
|
const now = /* @__PURE__ */ new Date();
|
|
const year = now.getFullYear();
|
|
const month = now.getMonth();
|
|
const day = now.getDate();
|
|
const date = /* @__PURE__ */ new Date(0);
|
|
date.setFullYear(year, month, day + 1);
|
|
date.setHours(23, 59, 59, 999);
|
|
return date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/endOfYesterday.mjs
|
|
function endOfYesterday() {
|
|
const now = /* @__PURE__ */ new Date();
|
|
const year = now.getFullYear();
|
|
const month = now.getMonth();
|
|
const day = now.getDate();
|
|
const date = /* @__PURE__ */ new Date(0);
|
|
date.setFullYear(year, month, day - 1);
|
|
date.setHours(23, 59, 59, 999);
|
|
return date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/locale/en-US/_lib/formatDistance.mjs
|
|
var formatDistanceLocale = {
|
|
lessThanXSeconds: {
|
|
one: "less than a second",
|
|
other: "less than {{count}} seconds"
|
|
},
|
|
xSeconds: {
|
|
one: "1 second",
|
|
other: "{{count}} seconds"
|
|
},
|
|
halfAMinute: "half a minute",
|
|
lessThanXMinutes: {
|
|
one: "less than a minute",
|
|
other: "less than {{count}} minutes"
|
|
},
|
|
xMinutes: {
|
|
one: "1 minute",
|
|
other: "{{count}} minutes"
|
|
},
|
|
aboutXHours: {
|
|
one: "about 1 hour",
|
|
other: "about {{count}} hours"
|
|
},
|
|
xHours: {
|
|
one: "1 hour",
|
|
other: "{{count}} hours"
|
|
},
|
|
xDays: {
|
|
one: "1 day",
|
|
other: "{{count}} days"
|
|
},
|
|
aboutXWeeks: {
|
|
one: "about 1 week",
|
|
other: "about {{count}} weeks"
|
|
},
|
|
xWeeks: {
|
|
one: "1 week",
|
|
other: "{{count}} weeks"
|
|
},
|
|
aboutXMonths: {
|
|
one: "about 1 month",
|
|
other: "about {{count}} months"
|
|
},
|
|
xMonths: {
|
|
one: "1 month",
|
|
other: "{{count}} months"
|
|
},
|
|
aboutXYears: {
|
|
one: "about 1 year",
|
|
other: "about {{count}} years"
|
|
},
|
|
xYears: {
|
|
one: "1 year",
|
|
other: "{{count}} years"
|
|
},
|
|
overXYears: {
|
|
one: "over 1 year",
|
|
other: "over {{count}} years"
|
|
},
|
|
almostXYears: {
|
|
one: "almost 1 year",
|
|
other: "almost {{count}} years"
|
|
}
|
|
};
|
|
var formatDistance = (token, count, options) => {
|
|
let result;
|
|
const tokenValue = formatDistanceLocale[token];
|
|
if (typeof tokenValue === "string") {
|
|
result = tokenValue;
|
|
} else if (count === 1) {
|
|
result = tokenValue.one;
|
|
} else {
|
|
result = tokenValue.other.replace("{{count}}", count.toString());
|
|
}
|
|
if (options == null ? void 0 : options.addSuffix) {
|
|
if (options.comparison && options.comparison > 0) {
|
|
return "in " + result;
|
|
} else {
|
|
return result + " ago";
|
|
}
|
|
}
|
|
return result;
|
|
};
|
|
|
|
// ../../node_modules/date-fns/locale/_lib/buildFormatLongFn.mjs
|
|
function buildFormatLongFn(args) {
|
|
return (options = {}) => {
|
|
const width = options.width ? String(options.width) : args.defaultWidth;
|
|
const format2 = args.formats[width] || args.formats[args.defaultWidth];
|
|
return format2;
|
|
};
|
|
}
|
|
|
|
// ../../node_modules/date-fns/locale/en-US/_lib/formatLong.mjs
|
|
var dateFormats = {
|
|
full: "EEEE, MMMM do, y",
|
|
long: "MMMM do, y",
|
|
medium: "MMM d, y",
|
|
short: "MM/dd/yyyy"
|
|
};
|
|
var timeFormats = {
|
|
full: "h:mm:ss a zzzz",
|
|
long: "h:mm:ss a z",
|
|
medium: "h:mm:ss a",
|
|
short: "h:mm a"
|
|
};
|
|
var dateTimeFormats = {
|
|
full: "{{date}} 'at' {{time}}",
|
|
long: "{{date}} 'at' {{time}}",
|
|
medium: "{{date}}, {{time}}",
|
|
short: "{{date}}, {{time}}"
|
|
};
|
|
var formatLong = {
|
|
date: buildFormatLongFn({
|
|
formats: dateFormats,
|
|
defaultWidth: "full"
|
|
}),
|
|
time: buildFormatLongFn({
|
|
formats: timeFormats,
|
|
defaultWidth: "full"
|
|
}),
|
|
dateTime: buildFormatLongFn({
|
|
formats: dateTimeFormats,
|
|
defaultWidth: "full"
|
|
})
|
|
};
|
|
|
|
// ../../node_modules/date-fns/locale/en-US/_lib/formatRelative.mjs
|
|
var formatRelativeLocale = {
|
|
lastWeek: "'last' eeee 'at' p",
|
|
yesterday: "'yesterday at' p",
|
|
today: "'today at' p",
|
|
tomorrow: "'tomorrow at' p",
|
|
nextWeek: "eeee 'at' p",
|
|
other: "P"
|
|
};
|
|
var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
|
|
|
|
// ../../node_modules/date-fns/locale/_lib/buildLocalizeFn.mjs
|
|
function buildLocalizeFn(args) {
|
|
return (value, options) => {
|
|
const context = (options == null ? void 0 : options.context) ? String(options.context) : "standalone";
|
|
let valuesArray;
|
|
if (context === "formatting" && args.formattingValues) {
|
|
const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
|
const width = (options == null ? void 0 : options.width) ? String(options.width) : defaultWidth;
|
|
valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
|
} else {
|
|
const defaultWidth = args.defaultWidth;
|
|
const width = (options == null ? void 0 : options.width) ? String(options.width) : args.defaultWidth;
|
|
valuesArray = args.values[width] || args.values[defaultWidth];
|
|
}
|
|
const index = args.argumentCallback ? args.argumentCallback(value) : value;
|
|
return valuesArray[index];
|
|
};
|
|
}
|
|
|
|
// ../../node_modules/date-fns/locale/en-US/_lib/localize.mjs
|
|
var eraValues = {
|
|
narrow: ["B", "A"],
|
|
abbreviated: ["BC", "AD"],
|
|
wide: ["Before Christ", "Anno Domini"]
|
|
};
|
|
var quarterValues = {
|
|
narrow: ["1", "2", "3", "4"],
|
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
};
|
|
var monthValues = {
|
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
abbreviated: [
|
|
"Jan",
|
|
"Feb",
|
|
"Mar",
|
|
"Apr",
|
|
"May",
|
|
"Jun",
|
|
"Jul",
|
|
"Aug",
|
|
"Sep",
|
|
"Oct",
|
|
"Nov",
|
|
"Dec"
|
|
],
|
|
wide: [
|
|
"January",
|
|
"February",
|
|
"March",
|
|
"April",
|
|
"May",
|
|
"June",
|
|
"July",
|
|
"August",
|
|
"September",
|
|
"October",
|
|
"November",
|
|
"December"
|
|
]
|
|
};
|
|
var dayValues = {
|
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
wide: [
|
|
"Sunday",
|
|
"Monday",
|
|
"Tuesday",
|
|
"Wednesday",
|
|
"Thursday",
|
|
"Friday",
|
|
"Saturday"
|
|
]
|
|
};
|
|
var dayPeriodValues = {
|
|
narrow: {
|
|
am: "a",
|
|
pm: "p",
|
|
midnight: "mi",
|
|
noon: "n",
|
|
morning: "morning",
|
|
afternoon: "afternoon",
|
|
evening: "evening",
|
|
night: "night"
|
|
},
|
|
abbreviated: {
|
|
am: "AM",
|
|
pm: "PM",
|
|
midnight: "midnight",
|
|
noon: "noon",
|
|
morning: "morning",
|
|
afternoon: "afternoon",
|
|
evening: "evening",
|
|
night: "night"
|
|
},
|
|
wide: {
|
|
am: "a.m.",
|
|
pm: "p.m.",
|
|
midnight: "midnight",
|
|
noon: "noon",
|
|
morning: "morning",
|
|
afternoon: "afternoon",
|
|
evening: "evening",
|
|
night: "night"
|
|
}
|
|
};
|
|
var formattingDayPeriodValues = {
|
|
narrow: {
|
|
am: "a",
|
|
pm: "p",
|
|
midnight: "mi",
|
|
noon: "n",
|
|
morning: "in the morning",
|
|
afternoon: "in the afternoon",
|
|
evening: "in the evening",
|
|
night: "at night"
|
|
},
|
|
abbreviated: {
|
|
am: "AM",
|
|
pm: "PM",
|
|
midnight: "midnight",
|
|
noon: "noon",
|
|
morning: "in the morning",
|
|
afternoon: "in the afternoon",
|
|
evening: "in the evening",
|
|
night: "at night"
|
|
},
|
|
wide: {
|
|
am: "a.m.",
|
|
pm: "p.m.",
|
|
midnight: "midnight",
|
|
noon: "noon",
|
|
morning: "in the morning",
|
|
afternoon: "in the afternoon",
|
|
evening: "in the evening",
|
|
night: "at night"
|
|
}
|
|
};
|
|
var ordinalNumber = (dirtyNumber, _options) => {
|
|
const number = Number(dirtyNumber);
|
|
const rem100 = number % 100;
|
|
if (rem100 > 20 || rem100 < 10) {
|
|
switch (rem100 % 10) {
|
|
case 1:
|
|
return number + "st";
|
|
case 2:
|
|
return number + "nd";
|
|
case 3:
|
|
return number + "rd";
|
|
}
|
|
}
|
|
return number + "th";
|
|
};
|
|
var localize = {
|
|
ordinalNumber,
|
|
era: buildLocalizeFn({
|
|
values: eraValues,
|
|
defaultWidth: "wide"
|
|
}),
|
|
quarter: buildLocalizeFn({
|
|
values: quarterValues,
|
|
defaultWidth: "wide",
|
|
argumentCallback: (quarter) => quarter - 1
|
|
}),
|
|
month: buildLocalizeFn({
|
|
values: monthValues,
|
|
defaultWidth: "wide"
|
|
}),
|
|
day: buildLocalizeFn({
|
|
values: dayValues,
|
|
defaultWidth: "wide"
|
|
}),
|
|
dayPeriod: buildLocalizeFn({
|
|
values: dayPeriodValues,
|
|
defaultWidth: "wide",
|
|
formattingValues: formattingDayPeriodValues,
|
|
defaultFormattingWidth: "wide"
|
|
})
|
|
};
|
|
|
|
// ../../node_modules/date-fns/locale/_lib/buildMatchFn.mjs
|
|
function buildMatchFn(args) {
|
|
return (string, options = {}) => {
|
|
const width = options.width;
|
|
const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
|
const matchResult = string.match(matchPattern);
|
|
if (!matchResult) {
|
|
return null;
|
|
}
|
|
const matchedString = matchResult[0];
|
|
const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
|
const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : (
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
findKey(parsePatterns, (pattern) => pattern.test(matchedString))
|
|
);
|
|
let value;
|
|
value = args.valueCallback ? args.valueCallback(key) : key;
|
|
value = options.valueCallback ? (
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
options.valueCallback(value)
|
|
) : value;
|
|
const rest = string.slice(matchedString.length);
|
|
return { value, rest };
|
|
};
|
|
}
|
|
function findKey(object, predicate) {
|
|
for (const key in object) {
|
|
if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
|
|
return key;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
function findIndex(array, predicate) {
|
|
for (let key = 0; key < array.length; key++) {
|
|
if (predicate(array[key])) {
|
|
return key;
|
|
}
|
|
}
|
|
return void 0;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/locale/_lib/buildMatchPatternFn.mjs
|
|
function buildMatchPatternFn(args) {
|
|
return (string, options = {}) => {
|
|
const matchResult = string.match(args.matchPattern);
|
|
if (!matchResult) return null;
|
|
const matchedString = matchResult[0];
|
|
const parseResult = string.match(args.parsePattern);
|
|
if (!parseResult) return null;
|
|
let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
|
value = options.valueCallback ? options.valueCallback(value) : value;
|
|
const rest = string.slice(matchedString.length);
|
|
return { value, rest };
|
|
};
|
|
}
|
|
|
|
// ../../node_modules/date-fns/locale/en-US/_lib/match.mjs
|
|
var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
|
var parseOrdinalNumberPattern = /\d+/i;
|
|
var matchEraPatterns = {
|
|
narrow: /^(b|a)/i,
|
|
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
};
|
|
var parseEraPatterns = {
|
|
any: [/^b/i, /^(a|c)/i]
|
|
};
|
|
var matchQuarterPatterns = {
|
|
narrow: /^[1234]/i,
|
|
abbreviated: /^q[1234]/i,
|
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
};
|
|
var parseQuarterPatterns = {
|
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
};
|
|
var matchMonthPatterns = {
|
|
narrow: /^[jfmasond]/i,
|
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
};
|
|
var parseMonthPatterns = {
|
|
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,
|
|
/^may/i,
|
|
/^jun/i,
|
|
/^jul/i,
|
|
/^au/i,
|
|
/^s/i,
|
|
/^o/i,
|
|
/^n/i,
|
|
/^d/i
|
|
]
|
|
};
|
|
var matchDayPatterns = {
|
|
narrow: /^[smtwf]/i,
|
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
};
|
|
var parseDayPatterns = {
|
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
};
|
|
var matchDayPeriodPatterns = {
|
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
};
|
|
var parseDayPeriodPatterns = {
|
|
any: {
|
|
am: /^a/i,
|
|
pm: /^p/i,
|
|
midnight: /^mi/i,
|
|
noon: /^no/i,
|
|
morning: /morning/i,
|
|
afternoon: /afternoon/i,
|
|
evening: /evening/i,
|
|
night: /night/i
|
|
}
|
|
};
|
|
var match = {
|
|
ordinalNumber: buildMatchPatternFn({
|
|
matchPattern: matchOrdinalNumberPattern,
|
|
parsePattern: parseOrdinalNumberPattern,
|
|
valueCallback: (value) => parseInt(value, 10)
|
|
}),
|
|
era: buildMatchFn({
|
|
matchPatterns: matchEraPatterns,
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: parseEraPatterns,
|
|
defaultParseWidth: "any"
|
|
}),
|
|
quarter: buildMatchFn({
|
|
matchPatterns: matchQuarterPatterns,
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: parseQuarterPatterns,
|
|
defaultParseWidth: "any",
|
|
valueCallback: (index) => index + 1
|
|
}),
|
|
month: buildMatchFn({
|
|
matchPatterns: matchMonthPatterns,
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: parseMonthPatterns,
|
|
defaultParseWidth: "any"
|
|
}),
|
|
day: buildMatchFn({
|
|
matchPatterns: matchDayPatterns,
|
|
defaultMatchWidth: "wide",
|
|
parsePatterns: parseDayPatterns,
|
|
defaultParseWidth: "any"
|
|
}),
|
|
dayPeriod: buildMatchFn({
|
|
matchPatterns: matchDayPeriodPatterns,
|
|
defaultMatchWidth: "any",
|
|
parsePatterns: parseDayPeriodPatterns,
|
|
defaultParseWidth: "any"
|
|
})
|
|
};
|
|
|
|
// ../../node_modules/date-fns/locale/en-US.mjs
|
|
var enUS = {
|
|
code: "en-US",
|
|
formatDistance,
|
|
formatLong,
|
|
formatRelative,
|
|
localize,
|
|
match,
|
|
options: {
|
|
weekStartsOn: 0,
|
|
firstWeekContainsDate: 1
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/getDayOfYear.mjs
|
|
function getDayOfYear(date) {
|
|
const _date = toDate(date);
|
|
const diff = differenceInCalendarDays(_date, startOfYear(_date));
|
|
const dayOfYear = diff + 1;
|
|
return dayOfYear;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getISOWeek.mjs
|
|
function getISOWeek(date) {
|
|
const _date = toDate(date);
|
|
const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
|
|
return Math.round(diff / millisecondsInWeek) + 1;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getWeekYear.mjs
|
|
function getWeekYear(date, options) {
|
|
var _a, _b, _c, _d;
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
|
|
const firstWeekOfNextYear = constructFrom(date, 0);
|
|
firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
|
|
firstWeekOfNextYear.setHours(0, 0, 0, 0);
|
|
const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
|
|
const firstWeekOfThisYear = constructFrom(date, 0);
|
|
firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
|
|
firstWeekOfThisYear.setHours(0, 0, 0, 0);
|
|
const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
|
|
if (_date.getTime() >= startOfNextYear.getTime()) {
|
|
return year + 1;
|
|
} else if (_date.getTime() >= startOfThisYear.getTime()) {
|
|
return year;
|
|
} else {
|
|
return year - 1;
|
|
}
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfWeekYear.mjs
|
|
function startOfWeekYear(date, options) {
|
|
var _a, _b, _c, _d;
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
|
|
const year = getWeekYear(date, options);
|
|
const firstWeek = constructFrom(date, 0);
|
|
firstWeek.setFullYear(year, 0, firstWeekContainsDate);
|
|
firstWeek.setHours(0, 0, 0, 0);
|
|
const _date = startOfWeek(firstWeek, options);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getWeek.mjs
|
|
function getWeek(date, options) {
|
|
const _date = toDate(date);
|
|
const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
|
|
return Math.round(diff / millisecondsInWeek) + 1;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/_lib/addLeadingZeros.mjs
|
|
function addLeadingZeros(number, targetLength) {
|
|
const sign = number < 0 ? "-" : "";
|
|
const output = Math.abs(number).toString().padStart(targetLength, "0");
|
|
return sign + output;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/_lib/format/lightFormatters.mjs
|
|
var lightFormatters = {
|
|
// Year
|
|
y(date, token) {
|
|
const signedYear = date.getFullYear();
|
|
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
|
},
|
|
// Month
|
|
M(date, token) {
|
|
const month = date.getMonth();
|
|
return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
},
|
|
// Day of the month
|
|
d(date, token) {
|
|
return addLeadingZeros(date.getDate(), token.length);
|
|
},
|
|
// AM or PM
|
|
a(date, token) {
|
|
const dayPeriodEnumValue = date.getHours() / 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(date, token) {
|
|
return addLeadingZeros(date.getHours() % 12 || 12, token.length);
|
|
},
|
|
// Hour [0-23]
|
|
H(date, token) {
|
|
return addLeadingZeros(date.getHours(), token.length);
|
|
},
|
|
// Minute
|
|
m(date, token) {
|
|
return addLeadingZeros(date.getMinutes(), token.length);
|
|
},
|
|
// Second
|
|
s(date, token) {
|
|
return addLeadingZeros(date.getSeconds(), token.length);
|
|
},
|
|
// Fraction of second
|
|
S(date, token) {
|
|
const numberOfDigits = token.length;
|
|
const milliseconds2 = date.getMilliseconds();
|
|
const fractionalSeconds = Math.trunc(
|
|
milliseconds2 * Math.pow(10, numberOfDigits - 3)
|
|
);
|
|
return addLeadingZeros(fractionalSeconds, token.length);
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/_lib/format/formatters.mjs
|
|
var dayPeriodEnum = {
|
|
am: "am",
|
|
pm: "pm",
|
|
midnight: "midnight",
|
|
noon: "noon",
|
|
morning: "morning",
|
|
afternoon: "afternoon",
|
|
evening: "evening",
|
|
night: "night"
|
|
};
|
|
var formatters = {
|
|
// Era
|
|
G: function(date, token, localize2) {
|
|
const era = date.getFullYear() > 0 ? 1 : 0;
|
|
switch (token) {
|
|
case "G":
|
|
case "GG":
|
|
case "GGG":
|
|
return localize2.era(era, { width: "abbreviated" });
|
|
case "GGGGG":
|
|
return localize2.era(era, { width: "narrow" });
|
|
case "GGGG":
|
|
default:
|
|
return localize2.era(era, { width: "wide" });
|
|
}
|
|
},
|
|
// Year
|
|
y: function(date, token, localize2) {
|
|
if (token === "yo") {
|
|
const signedYear = date.getFullYear();
|
|
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
return localize2.ordinalNumber(year, { unit: "year" });
|
|
}
|
|
return lightFormatters.y(date, token);
|
|
},
|
|
// Local week-numbering year
|
|
Y: function(date, token, localize2, options) {
|
|
const signedWeekYear = getWeekYear(date, options);
|
|
const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
if (token === "YY") {
|
|
const twoDigitYear = weekYear % 100;
|
|
return addLeadingZeros(twoDigitYear, 2);
|
|
}
|
|
if (token === "Yo") {
|
|
return localize2.ordinalNumber(weekYear, { unit: "year" });
|
|
}
|
|
return addLeadingZeros(weekYear, token.length);
|
|
},
|
|
// ISO week-numbering year
|
|
R: function(date, token) {
|
|
const isoWeekYear = getISOWeekYear(date);
|
|
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(date, token) {
|
|
const year = date.getFullYear();
|
|
return addLeadingZeros(year, token.length);
|
|
},
|
|
// Quarter
|
|
Q: function(date, token, localize2) {
|
|
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
switch (token) {
|
|
case "Q":
|
|
return String(quarter);
|
|
case "QQ":
|
|
return addLeadingZeros(quarter, 2);
|
|
case "Qo":
|
|
return localize2.ordinalNumber(quarter, { unit: "quarter" });
|
|
case "QQQ":
|
|
return localize2.quarter(quarter, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
});
|
|
case "QQQQQ":
|
|
return localize2.quarter(quarter, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "QQQQ":
|
|
default:
|
|
return localize2.quarter(quarter, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
},
|
|
// Stand-alone quarter
|
|
q: function(date, token, localize2) {
|
|
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
switch (token) {
|
|
case "q":
|
|
return String(quarter);
|
|
case "qq":
|
|
return addLeadingZeros(quarter, 2);
|
|
case "qo":
|
|
return localize2.ordinalNumber(quarter, { unit: "quarter" });
|
|
case "qqq":
|
|
return localize2.quarter(quarter, {
|
|
width: "abbreviated",
|
|
context: "standalone"
|
|
});
|
|
case "qqqqq":
|
|
return localize2.quarter(quarter, {
|
|
width: "narrow",
|
|
context: "standalone"
|
|
});
|
|
case "qqqq":
|
|
default:
|
|
return localize2.quarter(quarter, {
|
|
width: "wide",
|
|
context: "standalone"
|
|
});
|
|
}
|
|
},
|
|
// Month
|
|
M: function(date, token, localize2) {
|
|
const month = date.getMonth();
|
|
switch (token) {
|
|
case "M":
|
|
case "MM":
|
|
return lightFormatters.M(date, token);
|
|
case "Mo":
|
|
return localize2.ordinalNumber(month + 1, { unit: "month" });
|
|
case "MMM":
|
|
return localize2.month(month, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
});
|
|
case "MMMMM":
|
|
return localize2.month(month, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "MMMM":
|
|
default:
|
|
return localize2.month(month, { width: "wide", context: "formatting" });
|
|
}
|
|
},
|
|
// Stand-alone month
|
|
L: function(date, token, localize2) {
|
|
const month = date.getMonth();
|
|
switch (token) {
|
|
case "L":
|
|
return String(month + 1);
|
|
case "LL":
|
|
return addLeadingZeros(month + 1, 2);
|
|
case "Lo":
|
|
return localize2.ordinalNumber(month + 1, { unit: "month" });
|
|
case "LLL":
|
|
return localize2.month(month, {
|
|
width: "abbreviated",
|
|
context: "standalone"
|
|
});
|
|
case "LLLLL":
|
|
return localize2.month(month, {
|
|
width: "narrow",
|
|
context: "standalone"
|
|
});
|
|
case "LLLL":
|
|
default:
|
|
return localize2.month(month, { width: "wide", context: "standalone" });
|
|
}
|
|
},
|
|
// Local week of year
|
|
w: function(date, token, localize2, options) {
|
|
const week = getWeek(date, options);
|
|
if (token === "wo") {
|
|
return localize2.ordinalNumber(week, { unit: "week" });
|
|
}
|
|
return addLeadingZeros(week, token.length);
|
|
},
|
|
// ISO week of year
|
|
I: function(date, token, localize2) {
|
|
const isoWeek = getISOWeek(date);
|
|
if (token === "Io") {
|
|
return localize2.ordinalNumber(isoWeek, { unit: "week" });
|
|
}
|
|
return addLeadingZeros(isoWeek, token.length);
|
|
},
|
|
// Day of the month
|
|
d: function(date, token, localize2) {
|
|
if (token === "do") {
|
|
return localize2.ordinalNumber(date.getDate(), { unit: "date" });
|
|
}
|
|
return lightFormatters.d(date, token);
|
|
},
|
|
// Day of year
|
|
D: function(date, token, localize2) {
|
|
const dayOfYear = getDayOfYear(date);
|
|
if (token === "Do") {
|
|
return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
|
|
}
|
|
return addLeadingZeros(dayOfYear, token.length);
|
|
},
|
|
// Day of week
|
|
E: function(date, token, localize2) {
|
|
const dayOfWeek = date.getDay();
|
|
switch (token) {
|
|
case "E":
|
|
case "EE":
|
|
case "EEE":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
});
|
|
case "EEEEE":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "EEEEEE":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "short",
|
|
context: "formatting"
|
|
});
|
|
case "EEEE":
|
|
default:
|
|
return localize2.day(dayOfWeek, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
},
|
|
// Local day of week
|
|
e: function(date, token, localize2, options) {
|
|
const dayOfWeek = date.getDay();
|
|
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
switch (token) {
|
|
case "e":
|
|
return String(localDayOfWeek);
|
|
case "ee":
|
|
return addLeadingZeros(localDayOfWeek, 2);
|
|
case "eo":
|
|
return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
case "eee":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
});
|
|
case "eeeee":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "eeeeee":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "short",
|
|
context: "formatting"
|
|
});
|
|
case "eeee":
|
|
default:
|
|
return localize2.day(dayOfWeek, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
},
|
|
// Stand-alone local day of week
|
|
c: function(date, token, localize2, options) {
|
|
const dayOfWeek = date.getDay();
|
|
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
switch (token) {
|
|
case "c":
|
|
return String(localDayOfWeek);
|
|
case "cc":
|
|
return addLeadingZeros(localDayOfWeek, token.length);
|
|
case "co":
|
|
return localize2.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
case "ccc":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "abbreviated",
|
|
context: "standalone"
|
|
});
|
|
case "ccccc":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "narrow",
|
|
context: "standalone"
|
|
});
|
|
case "cccccc":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "short",
|
|
context: "standalone"
|
|
});
|
|
case "cccc":
|
|
default:
|
|
return localize2.day(dayOfWeek, {
|
|
width: "wide",
|
|
context: "standalone"
|
|
});
|
|
}
|
|
},
|
|
// ISO day of week
|
|
i: function(date, token, localize2) {
|
|
const dayOfWeek = date.getDay();
|
|
const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
switch (token) {
|
|
case "i":
|
|
return String(isoDayOfWeek);
|
|
case "ii":
|
|
return addLeadingZeros(isoDayOfWeek, token.length);
|
|
case "io":
|
|
return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" });
|
|
case "iii":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
});
|
|
case "iiiii":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "iiiiii":
|
|
return localize2.day(dayOfWeek, {
|
|
width: "short",
|
|
context: "formatting"
|
|
});
|
|
case "iiii":
|
|
default:
|
|
return localize2.day(dayOfWeek, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
},
|
|
// AM or PM
|
|
a: function(date, token, localize2) {
|
|
const hours = date.getHours();
|
|
const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
|
switch (token) {
|
|
case "a":
|
|
case "aa":
|
|
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
});
|
|
case "aaa":
|
|
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}).toLowerCase();
|
|
case "aaaaa":
|
|
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "aaaa":
|
|
default:
|
|
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
},
|
|
// AM, PM, midnight, noon
|
|
b: function(date, token, localize2) {
|
|
const hours = date.getHours();
|
|
let 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 localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
});
|
|
case "bbb":
|
|
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}).toLowerCase();
|
|
case "bbbbb":
|
|
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "bbbb":
|
|
default:
|
|
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
},
|
|
// in the morning, in the afternoon, in the evening, at night
|
|
B: function(date, token, localize2) {
|
|
const hours = date.getHours();
|
|
let 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 localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
});
|
|
case "BBBBB":
|
|
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "BBBB":
|
|
default:
|
|
return localize2.dayPeriod(dayPeriodEnumValue, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
},
|
|
// Hour [1-12]
|
|
h: function(date, token, localize2) {
|
|
if (token === "ho") {
|
|
let hours = date.getHours() % 12;
|
|
if (hours === 0) hours = 12;
|
|
return localize2.ordinalNumber(hours, { unit: "hour" });
|
|
}
|
|
return lightFormatters.h(date, token);
|
|
},
|
|
// Hour [0-23]
|
|
H: function(date, token, localize2) {
|
|
if (token === "Ho") {
|
|
return localize2.ordinalNumber(date.getHours(), { unit: "hour" });
|
|
}
|
|
return lightFormatters.H(date, token);
|
|
},
|
|
// Hour [0-11]
|
|
K: function(date, token, localize2) {
|
|
const hours = date.getHours() % 12;
|
|
if (token === "Ko") {
|
|
return localize2.ordinalNumber(hours, { unit: "hour" });
|
|
}
|
|
return addLeadingZeros(hours, token.length);
|
|
},
|
|
// Hour [1-24]
|
|
k: function(date, token, localize2) {
|
|
let hours = date.getHours();
|
|
if (hours === 0) hours = 24;
|
|
if (token === "ko") {
|
|
return localize2.ordinalNumber(hours, { unit: "hour" });
|
|
}
|
|
return addLeadingZeros(hours, token.length);
|
|
},
|
|
// Minute
|
|
m: function(date, token, localize2) {
|
|
if (token === "mo") {
|
|
return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" });
|
|
}
|
|
return lightFormatters.m(date, token);
|
|
},
|
|
// Second
|
|
s: function(date, token, localize2) {
|
|
if (token === "so") {
|
|
return localize2.ordinalNumber(date.getSeconds(), { unit: "second" });
|
|
}
|
|
return lightFormatters.s(date, token);
|
|
},
|
|
// Fraction of second
|
|
S: function(date, token) {
|
|
return lightFormatters.S(date, token);
|
|
},
|
|
// Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
|
|
X: function(date, token, _localize) {
|
|
const timezoneOffset = date.getTimezoneOffset();
|
|
if (timezoneOffset === 0) {
|
|
return "Z";
|
|
}
|
|
switch (token) {
|
|
case "X":
|
|
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
case "XXXX":
|
|
case "XX":
|
|
return formatTimezone(timezoneOffset);
|
|
case "XXXXX":
|
|
case "XXX":
|
|
default:
|
|
return formatTimezone(timezoneOffset, ":");
|
|
}
|
|
},
|
|
// Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
|
|
x: function(date, token, _localize) {
|
|
const timezoneOffset = date.getTimezoneOffset();
|
|
switch (token) {
|
|
case "x":
|
|
return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
case "xxxx":
|
|
case "xx":
|
|
return formatTimezone(timezoneOffset);
|
|
case "xxxxx":
|
|
case "xxx":
|
|
default:
|
|
return formatTimezone(timezoneOffset, ":");
|
|
}
|
|
},
|
|
// Timezone (GMT)
|
|
O: function(date, token, _localize) {
|
|
const timezoneOffset = date.getTimezoneOffset();
|
|
switch (token) {
|
|
case "O":
|
|
case "OO":
|
|
case "OOO":
|
|
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
case "OOOO":
|
|
default:
|
|
return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
}
|
|
},
|
|
// Timezone (specific non-location)
|
|
z: function(date, token, _localize) {
|
|
const timezoneOffset = date.getTimezoneOffset();
|
|
switch (token) {
|
|
case "z":
|
|
case "zz":
|
|
case "zzz":
|
|
return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
case "zzzz":
|
|
default:
|
|
return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
}
|
|
},
|
|
// Seconds timestamp
|
|
t: function(date, token, _localize) {
|
|
const timestamp = Math.trunc(date.getTime() / 1e3);
|
|
return addLeadingZeros(timestamp, token.length);
|
|
},
|
|
// Milliseconds timestamp
|
|
T: function(date, token, _localize) {
|
|
const timestamp = date.getTime();
|
|
return addLeadingZeros(timestamp, token.length);
|
|
}
|
|
};
|
|
function formatTimezoneShort(offset, delimiter = "") {
|
|
const sign = offset > 0 ? "-" : "+";
|
|
const absOffset = Math.abs(offset);
|
|
const hours = Math.trunc(absOffset / 60);
|
|
const minutes = absOffset % 60;
|
|
if (minutes === 0) {
|
|
return sign + String(hours);
|
|
}
|
|
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
}
|
|
function formatTimezoneWithOptionalMinutes(offset, delimiter) {
|
|
if (offset % 60 === 0) {
|
|
const sign = offset > 0 ? "-" : "+";
|
|
return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
}
|
|
return formatTimezone(offset, delimiter);
|
|
}
|
|
function formatTimezone(offset, delimiter = "") {
|
|
const sign = offset > 0 ? "-" : "+";
|
|
const absOffset = Math.abs(offset);
|
|
const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
|
|
const minutes = addLeadingZeros(absOffset % 60, 2);
|
|
return sign + hours + delimiter + minutes;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/_lib/format/longFormatters.mjs
|
|
var dateLongFormatter = (pattern, formatLong2) => {
|
|
switch (pattern) {
|
|
case "P":
|
|
return formatLong2.date({ width: "short" });
|
|
case "PP":
|
|
return formatLong2.date({ width: "medium" });
|
|
case "PPP":
|
|
return formatLong2.date({ width: "long" });
|
|
case "PPPP":
|
|
default:
|
|
return formatLong2.date({ width: "full" });
|
|
}
|
|
};
|
|
var timeLongFormatter = (pattern, formatLong2) => {
|
|
switch (pattern) {
|
|
case "p":
|
|
return formatLong2.time({ width: "short" });
|
|
case "pp":
|
|
return formatLong2.time({ width: "medium" });
|
|
case "ppp":
|
|
return formatLong2.time({ width: "long" });
|
|
case "pppp":
|
|
default:
|
|
return formatLong2.time({ width: "full" });
|
|
}
|
|
};
|
|
var dateTimeLongFormatter = (pattern, formatLong2) => {
|
|
const matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
const datePattern = matchResult[1];
|
|
const timePattern = matchResult[2];
|
|
if (!timePattern) {
|
|
return dateLongFormatter(pattern, formatLong2);
|
|
}
|
|
let dateTimeFormat;
|
|
switch (datePattern) {
|
|
case "P":
|
|
dateTimeFormat = formatLong2.dateTime({ width: "short" });
|
|
break;
|
|
case "PP":
|
|
dateTimeFormat = formatLong2.dateTime({ width: "medium" });
|
|
break;
|
|
case "PPP":
|
|
dateTimeFormat = formatLong2.dateTime({ width: "long" });
|
|
break;
|
|
case "PPPP":
|
|
default:
|
|
dateTimeFormat = formatLong2.dateTime({ width: "full" });
|
|
break;
|
|
}
|
|
return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
|
|
};
|
|
var longFormatters = {
|
|
p: timeLongFormatter,
|
|
P: dateTimeLongFormatter
|
|
};
|
|
|
|
// ../../node_modules/date-fns/_lib/protectedTokens.mjs
|
|
var dayOfYearTokenRE = /^D+$/;
|
|
var weekYearTokenRE = /^Y+$/;
|
|
var throwTokens = ["D", "DD", "YY", "YYYY"];
|
|
function isProtectedDayOfYearToken(token) {
|
|
return dayOfYearTokenRE.test(token);
|
|
}
|
|
function isProtectedWeekYearToken(token) {
|
|
return weekYearTokenRE.test(token);
|
|
}
|
|
function warnOrThrowProtectedError(token, format2, input) {
|
|
const _message = message(token, format2, input);
|
|
console.warn(_message);
|
|
if (throwTokens.includes(token)) throw new RangeError(_message);
|
|
}
|
|
function message(token, format2, input) {
|
|
const subject = token[0] === "Y" ? "years" : "days of the month";
|
|
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/format.mjs
|
|
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
var escapedStringRegExp = /^'([^]*?)'?$/;
|
|
var doubleQuoteRegExp = /''/g;
|
|
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
function format(date, formatStr, options) {
|
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const locale = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
|
|
const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
|
|
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_f = (_e = options == null ? void 0 : options.locale) == null ? void 0 : _e.options) == null ? void 0 : _f.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_h = (_g = defaultOptions2.locale) == null ? void 0 : _g.options) == null ? void 0 : _h.weekStartsOn) ?? 0;
|
|
const originalDate = toDate(date);
|
|
if (!isValid(originalDate)) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
|
|
const firstCharacter = substring[0];
|
|
if (firstCharacter === "p" || firstCharacter === "P") {
|
|
const longFormatter = longFormatters[firstCharacter];
|
|
return longFormatter(substring, locale.formatLong);
|
|
}
|
|
return substring;
|
|
}).join("").match(formattingTokensRegExp).map((substring) => {
|
|
if (substring === "''") {
|
|
return { isToken: false, value: "'" };
|
|
}
|
|
const firstCharacter = substring[0];
|
|
if (firstCharacter === "'") {
|
|
return { isToken: false, value: cleanEscapedString(substring) };
|
|
}
|
|
if (formatters[firstCharacter]) {
|
|
return { isToken: true, value: substring };
|
|
}
|
|
if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
|
throw new RangeError(
|
|
"Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
|
|
);
|
|
}
|
|
return { isToken: false, value: substring };
|
|
});
|
|
if (locale.localize.preprocessor) {
|
|
parts = locale.localize.preprocessor(originalDate, parts);
|
|
}
|
|
const formatterOptions = {
|
|
firstWeekContainsDate,
|
|
weekStartsOn,
|
|
locale
|
|
};
|
|
return parts.map((part) => {
|
|
if (!part.isToken) return part.value;
|
|
const token = part.value;
|
|
if (!(options == null ? void 0 : options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token) || !(options == null ? void 0 : options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {
|
|
warnOrThrowProtectedError(token, formatStr, String(date));
|
|
}
|
|
const formatter = formatters[token[0]];
|
|
return formatter(originalDate, token, locale.localize, formatterOptions);
|
|
}).join("");
|
|
}
|
|
function cleanEscapedString(input) {
|
|
const matched = input.match(escapedStringRegExp);
|
|
if (!matched) {
|
|
return input;
|
|
}
|
|
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatDistance.mjs
|
|
function formatDistance2(date, baseDate, options) {
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const locale = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
|
|
const minutesInAlmostTwoDays = 2520;
|
|
const comparison = compareAsc(date, baseDate);
|
|
if (isNaN(comparison)) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
const localizeOptions = Object.assign({}, options, {
|
|
addSuffix: options == null ? void 0 : options.addSuffix,
|
|
comparison
|
|
});
|
|
let dateLeft;
|
|
let dateRight;
|
|
if (comparison > 0) {
|
|
dateLeft = toDate(baseDate);
|
|
dateRight = toDate(date);
|
|
} else {
|
|
dateLeft = toDate(date);
|
|
dateRight = toDate(baseDate);
|
|
}
|
|
const seconds = differenceInSeconds(dateRight, dateLeft);
|
|
const offsetInSeconds = (getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft)) / 1e3;
|
|
const minutes = Math.round((seconds - offsetInSeconds) / 60);
|
|
let months2;
|
|
if (minutes < 2) {
|
|
if (options == null ? void 0 : options.includeSeconds) {
|
|
if (seconds < 5) {
|
|
return locale.formatDistance("lessThanXSeconds", 5, localizeOptions);
|
|
} else if (seconds < 10) {
|
|
return locale.formatDistance("lessThanXSeconds", 10, localizeOptions);
|
|
} else if (seconds < 20) {
|
|
return locale.formatDistance("lessThanXSeconds", 20, localizeOptions);
|
|
} else if (seconds < 40) {
|
|
return locale.formatDistance("halfAMinute", 0, localizeOptions);
|
|
} else if (seconds < 60) {
|
|
return locale.formatDistance("lessThanXMinutes", 1, localizeOptions);
|
|
} else {
|
|
return locale.formatDistance("xMinutes", 1, localizeOptions);
|
|
}
|
|
} else {
|
|
if (minutes === 0) {
|
|
return locale.formatDistance("lessThanXMinutes", 1, localizeOptions);
|
|
} else {
|
|
return locale.formatDistance("xMinutes", minutes, localizeOptions);
|
|
}
|
|
}
|
|
} else if (minutes < 45) {
|
|
return locale.formatDistance("xMinutes", minutes, localizeOptions);
|
|
} else if (minutes < 90) {
|
|
return locale.formatDistance("aboutXHours", 1, localizeOptions);
|
|
} else if (minutes < minutesInDay) {
|
|
const hours = Math.round(minutes / 60);
|
|
return locale.formatDistance("aboutXHours", hours, localizeOptions);
|
|
} else if (minutes < minutesInAlmostTwoDays) {
|
|
return locale.formatDistance("xDays", 1, localizeOptions);
|
|
} else if (minutes < minutesInMonth) {
|
|
const days2 = Math.round(minutes / minutesInDay);
|
|
return locale.formatDistance("xDays", days2, localizeOptions);
|
|
} else if (minutes < minutesInMonth * 2) {
|
|
months2 = Math.round(minutes / minutesInMonth);
|
|
return locale.formatDistance("aboutXMonths", months2, localizeOptions);
|
|
}
|
|
months2 = differenceInMonths(dateRight, dateLeft);
|
|
if (months2 < 12) {
|
|
const nearestMonth = Math.round(minutes / minutesInMonth);
|
|
return locale.formatDistance("xMonths", nearestMonth, localizeOptions);
|
|
} else {
|
|
const monthsSinceStartOfYear = months2 % 12;
|
|
const years = Math.trunc(months2 / 12);
|
|
if (monthsSinceStartOfYear < 3) {
|
|
return locale.formatDistance("aboutXYears", years, localizeOptions);
|
|
} else if (monthsSinceStartOfYear < 9) {
|
|
return locale.formatDistance("overXYears", years, localizeOptions);
|
|
} else {
|
|
return locale.formatDistance("almostXYears", years + 1, localizeOptions);
|
|
}
|
|
}
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatDistanceStrict.mjs
|
|
function formatDistanceStrict(date, baseDate, options) {
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const locale = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
|
|
const comparison = compareAsc(date, baseDate);
|
|
if (isNaN(comparison)) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
const localizeOptions = Object.assign({}, options, {
|
|
addSuffix: options == null ? void 0 : options.addSuffix,
|
|
comparison
|
|
});
|
|
let dateLeft;
|
|
let dateRight;
|
|
if (comparison > 0) {
|
|
dateLeft = toDate(baseDate);
|
|
dateRight = toDate(date);
|
|
} else {
|
|
dateLeft = toDate(date);
|
|
dateRight = toDate(baseDate);
|
|
}
|
|
const roundingMethod = getRoundingMethod((options == null ? void 0 : options.roundingMethod) ?? "round");
|
|
const milliseconds2 = dateRight.getTime() - dateLeft.getTime();
|
|
const minutes = milliseconds2 / millisecondsInMinute;
|
|
const timezoneOffset = getTimezoneOffsetInMilliseconds(dateRight) - getTimezoneOffsetInMilliseconds(dateLeft);
|
|
const dstNormalizedMinutes = (milliseconds2 - timezoneOffset) / millisecondsInMinute;
|
|
const defaultUnit = options == null ? void 0 : options.unit;
|
|
let unit;
|
|
if (!defaultUnit) {
|
|
if (minutes < 1) {
|
|
unit = "second";
|
|
} else if (minutes < 60) {
|
|
unit = "minute";
|
|
} else if (minutes < minutesInDay) {
|
|
unit = "hour";
|
|
} else if (dstNormalizedMinutes < minutesInMonth) {
|
|
unit = "day";
|
|
} else if (dstNormalizedMinutes < minutesInYear) {
|
|
unit = "month";
|
|
} else {
|
|
unit = "year";
|
|
}
|
|
} else {
|
|
unit = defaultUnit;
|
|
}
|
|
if (unit === "second") {
|
|
const seconds = roundingMethod(milliseconds2 / 1e3);
|
|
return locale.formatDistance("xSeconds", seconds, localizeOptions);
|
|
} else if (unit === "minute") {
|
|
const roundedMinutes = roundingMethod(minutes);
|
|
return locale.formatDistance("xMinutes", roundedMinutes, localizeOptions);
|
|
} else if (unit === "hour") {
|
|
const hours = roundingMethod(minutes / 60);
|
|
return locale.formatDistance("xHours", hours, localizeOptions);
|
|
} else if (unit === "day") {
|
|
const days2 = roundingMethod(dstNormalizedMinutes / minutesInDay);
|
|
return locale.formatDistance("xDays", days2, localizeOptions);
|
|
} else if (unit === "month") {
|
|
const months2 = roundingMethod(dstNormalizedMinutes / minutesInMonth);
|
|
return months2 === 12 && defaultUnit !== "month" ? locale.formatDistance("xYears", 1, localizeOptions) : locale.formatDistance("xMonths", months2, localizeOptions);
|
|
} else {
|
|
const years = roundingMethod(dstNormalizedMinutes / minutesInYear);
|
|
return locale.formatDistance("xYears", years, localizeOptions);
|
|
}
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatDistanceToNow.mjs
|
|
function formatDistanceToNow(date, options) {
|
|
return formatDistance2(date, constructNow(date), options);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatDistanceToNowStrict.mjs
|
|
function formatDistanceToNowStrict(date, options) {
|
|
return formatDistanceStrict(date, constructNow(date), options);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatDuration.mjs
|
|
var defaultFormat = [
|
|
"years",
|
|
"months",
|
|
"weeks",
|
|
"days",
|
|
"hours",
|
|
"minutes",
|
|
"seconds"
|
|
];
|
|
function formatDuration(duration, options) {
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const locale = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
|
|
const format2 = (options == null ? void 0 : options.format) ?? defaultFormat;
|
|
const zero = (options == null ? void 0 : options.zero) ?? false;
|
|
const delimiter = (options == null ? void 0 : options.delimiter) ?? " ";
|
|
if (!locale.formatDistance) {
|
|
return "";
|
|
}
|
|
const result = format2.reduce((acc, unit) => {
|
|
const token = `x${unit.replace(/(^.)/, (m) => m.toUpperCase())}`;
|
|
const value = duration[unit];
|
|
if (value !== void 0 && (zero || duration[unit])) {
|
|
return acc.concat(locale.formatDistance(token, value));
|
|
}
|
|
return acc;
|
|
}, []).join(delimiter);
|
|
return result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatISO.mjs
|
|
function formatISO(date, options) {
|
|
const _date = toDate(date);
|
|
if (isNaN(_date.getTime())) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
const format2 = (options == null ? void 0 : options.format) ?? "extended";
|
|
const representation = (options == null ? void 0 : options.representation) ?? "complete";
|
|
let result = "";
|
|
let tzOffset = "";
|
|
const dateDelimiter = format2 === "extended" ? "-" : "";
|
|
const timeDelimiter = format2 === "extended" ? ":" : "";
|
|
if (representation !== "time") {
|
|
const day = addLeadingZeros(_date.getDate(), 2);
|
|
const month = addLeadingZeros(_date.getMonth() + 1, 2);
|
|
const year = addLeadingZeros(_date.getFullYear(), 4);
|
|
result = `${year}${dateDelimiter}${month}${dateDelimiter}${day}`;
|
|
}
|
|
if (representation !== "date") {
|
|
const offset = _date.getTimezoneOffset();
|
|
if (offset !== 0) {
|
|
const absoluteOffset = Math.abs(offset);
|
|
const hourOffset = addLeadingZeros(Math.trunc(absoluteOffset / 60), 2);
|
|
const minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);
|
|
const sign = offset < 0 ? "+" : "-";
|
|
tzOffset = `${sign}${hourOffset}:${minuteOffset}`;
|
|
} else {
|
|
tzOffset = "Z";
|
|
}
|
|
const hour = addLeadingZeros(_date.getHours(), 2);
|
|
const minute = addLeadingZeros(_date.getMinutes(), 2);
|
|
const second = addLeadingZeros(_date.getSeconds(), 2);
|
|
const separator = result === "" ? "" : "T";
|
|
const time = [hour, minute, second].join(timeDelimiter);
|
|
result = `${result}${separator}${time}${tzOffset}`;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatISO9075.mjs
|
|
function formatISO9075(date, options) {
|
|
const _date = toDate(date);
|
|
if (!isValid(_date)) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
const format2 = (options == null ? void 0 : options.format) ?? "extended";
|
|
const representation = (options == null ? void 0 : options.representation) ?? "complete";
|
|
let result = "";
|
|
const dateDelimiter = format2 === "extended" ? "-" : "";
|
|
const timeDelimiter = format2 === "extended" ? ":" : "";
|
|
if (representation !== "time") {
|
|
const day = addLeadingZeros(_date.getDate(), 2);
|
|
const month = addLeadingZeros(_date.getMonth() + 1, 2);
|
|
const year = addLeadingZeros(_date.getFullYear(), 4);
|
|
result = `${year}${dateDelimiter}${month}${dateDelimiter}${day}`;
|
|
}
|
|
if (representation !== "date") {
|
|
const hour = addLeadingZeros(_date.getHours(), 2);
|
|
const minute = addLeadingZeros(_date.getMinutes(), 2);
|
|
const second = addLeadingZeros(_date.getSeconds(), 2);
|
|
const separator = result === "" ? "" : " ";
|
|
result = `${result}${separator}${hour}${timeDelimiter}${minute}${timeDelimiter}${second}`;
|
|
}
|
|
return result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatISODuration.mjs
|
|
function formatISODuration(duration) {
|
|
const {
|
|
years = 0,
|
|
months: months2 = 0,
|
|
days: days2 = 0,
|
|
hours = 0,
|
|
minutes = 0,
|
|
seconds = 0
|
|
} = duration;
|
|
return `P${years}Y${months2}M${days2}DT${hours}H${minutes}M${seconds}S`;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatRFC3339.mjs
|
|
function formatRFC3339(date, options) {
|
|
const _date = toDate(date);
|
|
if (!isValid(_date)) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
const fractionDigits = (options == null ? void 0 : options.fractionDigits) ?? 0;
|
|
const day = addLeadingZeros(_date.getDate(), 2);
|
|
const month = addLeadingZeros(_date.getMonth() + 1, 2);
|
|
const year = _date.getFullYear();
|
|
const hour = addLeadingZeros(_date.getHours(), 2);
|
|
const minute = addLeadingZeros(_date.getMinutes(), 2);
|
|
const second = addLeadingZeros(_date.getSeconds(), 2);
|
|
let fractionalSecond = "";
|
|
if (fractionDigits > 0) {
|
|
const milliseconds2 = _date.getMilliseconds();
|
|
const fractionalSeconds = Math.trunc(
|
|
milliseconds2 * Math.pow(10, fractionDigits - 3)
|
|
);
|
|
fractionalSecond = "." + addLeadingZeros(fractionalSeconds, fractionDigits);
|
|
}
|
|
let offset = "";
|
|
const tzOffset = _date.getTimezoneOffset();
|
|
if (tzOffset !== 0) {
|
|
const absoluteOffset = Math.abs(tzOffset);
|
|
const hourOffset = addLeadingZeros(Math.trunc(absoluteOffset / 60), 2);
|
|
const minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);
|
|
const sign = tzOffset < 0 ? "+" : "-";
|
|
offset = `${sign}${hourOffset}:${minuteOffset}`;
|
|
} else {
|
|
offset = "Z";
|
|
}
|
|
return `${year}-${month}-${day}T${hour}:${minute}:${second}${fractionalSecond}${offset}`;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatRFC7231.mjs
|
|
var days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
var months = [
|
|
"Jan",
|
|
"Feb",
|
|
"Mar",
|
|
"Apr",
|
|
"May",
|
|
"Jun",
|
|
"Jul",
|
|
"Aug",
|
|
"Sep",
|
|
"Oct",
|
|
"Nov",
|
|
"Dec"
|
|
];
|
|
function formatRFC7231(date) {
|
|
const _date = toDate(date);
|
|
if (!isValid(_date)) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
const dayName = days[_date.getUTCDay()];
|
|
const dayOfMonth = addLeadingZeros(_date.getUTCDate(), 2);
|
|
const monthName = months[_date.getUTCMonth()];
|
|
const year = _date.getUTCFullYear();
|
|
const hour = addLeadingZeros(_date.getUTCHours(), 2);
|
|
const minute = addLeadingZeros(_date.getUTCMinutes(), 2);
|
|
const second = addLeadingZeros(_date.getUTCSeconds(), 2);
|
|
return `${dayName}, ${dayOfMonth} ${monthName} ${year} ${hour}:${minute}:${second} GMT`;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/formatRelative.mjs
|
|
function formatRelative2(date, baseDate, options) {
|
|
var _a, _b, _c, _d;
|
|
const _date = toDate(date);
|
|
const _baseDate = toDate(baseDate);
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const locale = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
|
|
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
|
const diff = differenceInCalendarDays(_date, _baseDate);
|
|
if (isNaN(diff)) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
let token;
|
|
if (diff < -6) {
|
|
token = "other";
|
|
} else if (diff < -1) {
|
|
token = "lastWeek";
|
|
} else if (diff < 0) {
|
|
token = "yesterday";
|
|
} else if (diff < 1) {
|
|
token = "today";
|
|
} else if (diff < 2) {
|
|
token = "tomorrow";
|
|
} else if (diff < 7) {
|
|
token = "nextWeek";
|
|
} else {
|
|
token = "other";
|
|
}
|
|
const formatStr = locale.formatRelative(token, _date, _baseDate, {
|
|
locale,
|
|
weekStartsOn
|
|
});
|
|
return format(_date, formatStr, { locale, weekStartsOn });
|
|
}
|
|
|
|
// ../../node_modules/date-fns/fromUnixTime.mjs
|
|
function fromUnixTime(unixTime) {
|
|
return toDate(unixTime * 1e3);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getDate.mjs
|
|
function getDate(date) {
|
|
const _date = toDate(date);
|
|
const dayOfMonth = _date.getDate();
|
|
return dayOfMonth;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getDay.mjs
|
|
function getDay(date) {
|
|
const _date = toDate(date);
|
|
const day = _date.getDay();
|
|
return day;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getDaysInMonth.mjs
|
|
function getDaysInMonth(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
const monthIndex = _date.getMonth();
|
|
const lastDayOfMonth2 = constructFrom(date, 0);
|
|
lastDayOfMonth2.setFullYear(year, monthIndex + 1, 0);
|
|
lastDayOfMonth2.setHours(0, 0, 0, 0);
|
|
return lastDayOfMonth2.getDate();
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isLeapYear.mjs
|
|
function isLeapYear(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getDaysInYear.mjs
|
|
function getDaysInYear(date) {
|
|
const _date = toDate(date);
|
|
if (String(new Date(_date)) === "Invalid Date") {
|
|
return NaN;
|
|
}
|
|
return isLeapYear(_date) ? 366 : 365;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getDecade.mjs
|
|
function getDecade(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
const decade = Math.floor(year / 10) * 10;
|
|
return decade;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getDefaultOptions.mjs
|
|
function getDefaultOptions2() {
|
|
return Object.assign({}, getDefaultOptions());
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getHours.mjs
|
|
function getHours(date) {
|
|
const _date = toDate(date);
|
|
const hours = _date.getHours();
|
|
return hours;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getISODay.mjs
|
|
function getISODay(date) {
|
|
const _date = toDate(date);
|
|
let day = _date.getDay();
|
|
if (day === 0) {
|
|
day = 7;
|
|
}
|
|
return day;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getISOWeeksInYear.mjs
|
|
function getISOWeeksInYear(date) {
|
|
const thisYear = startOfISOWeekYear(date);
|
|
const nextYear = startOfISOWeekYear(addWeeks(thisYear, 60));
|
|
const diff = +nextYear - +thisYear;
|
|
return Math.round(diff / millisecondsInWeek);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getMilliseconds.mjs
|
|
function getMilliseconds(date) {
|
|
const _date = toDate(date);
|
|
const milliseconds2 = _date.getMilliseconds();
|
|
return milliseconds2;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getMinutes.mjs
|
|
function getMinutes(date) {
|
|
const _date = toDate(date);
|
|
const minutes = _date.getMinutes();
|
|
return minutes;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getMonth.mjs
|
|
function getMonth(date) {
|
|
const _date = toDate(date);
|
|
const month = _date.getMonth();
|
|
return month;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getOverlappingDaysInIntervals.mjs
|
|
function getOverlappingDaysInIntervals(intervalLeft, intervalRight) {
|
|
const [leftStart, leftEnd] = [
|
|
+toDate(intervalLeft.start),
|
|
+toDate(intervalLeft.end)
|
|
].sort((a, b) => a - b);
|
|
const [rightStart, rightEnd] = [
|
|
+toDate(intervalRight.start),
|
|
+toDate(intervalRight.end)
|
|
].sort((a, b) => a - b);
|
|
const isOverlapping = leftStart < rightEnd && rightStart < leftEnd;
|
|
if (!isOverlapping) return 0;
|
|
const overlapLeft = rightStart < leftStart ? leftStart : rightStart;
|
|
const left = overlapLeft - getTimezoneOffsetInMilliseconds(overlapLeft);
|
|
const overlapRight = rightEnd > leftEnd ? leftEnd : rightEnd;
|
|
const right = overlapRight - getTimezoneOffsetInMilliseconds(overlapRight);
|
|
return Math.ceil((right - left) / millisecondsInDay);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getSeconds.mjs
|
|
function getSeconds(date) {
|
|
const _date = toDate(date);
|
|
const seconds = _date.getSeconds();
|
|
return seconds;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getTime.mjs
|
|
function getTime(date) {
|
|
const _date = toDate(date);
|
|
const timestamp = _date.getTime();
|
|
return timestamp;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getUnixTime.mjs
|
|
function getUnixTime(date) {
|
|
return Math.trunc(+toDate(date) / 1e3);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getWeekOfMonth.mjs
|
|
function getWeekOfMonth(date, options) {
|
|
var _a, _b, _c, _d;
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
|
const currentDayOfMonth = getDate(date);
|
|
if (isNaN(currentDayOfMonth)) return NaN;
|
|
const startWeekDay = getDay(startOfMonth(date));
|
|
let lastDayOfFirstWeek = weekStartsOn - startWeekDay;
|
|
if (lastDayOfFirstWeek <= 0) lastDayOfFirstWeek += 7;
|
|
const remainingDaysAfterFirstWeek = currentDayOfMonth - lastDayOfFirstWeek;
|
|
return Math.ceil(remainingDaysAfterFirstWeek / 7) + 1;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/lastDayOfMonth.mjs
|
|
function lastDayOfMonth(date) {
|
|
const _date = toDate(date);
|
|
const month = _date.getMonth();
|
|
_date.setFullYear(_date.getFullYear(), month + 1, 0);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getWeeksInMonth.mjs
|
|
function getWeeksInMonth(date, options) {
|
|
return differenceInCalendarWeeks(
|
|
lastDayOfMonth(date),
|
|
startOfMonth(date),
|
|
options
|
|
) + 1;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/getYear.mjs
|
|
function getYear(date) {
|
|
return toDate(date).getFullYear();
|
|
}
|
|
|
|
// ../../node_modules/date-fns/hoursToMilliseconds.mjs
|
|
function hoursToMilliseconds(hours) {
|
|
return Math.trunc(hours * millisecondsInHour);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/hoursToMinutes.mjs
|
|
function hoursToMinutes(hours) {
|
|
return Math.trunc(hours * minutesInHour);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/hoursToSeconds.mjs
|
|
function hoursToSeconds(hours) {
|
|
return Math.trunc(hours * secondsInHour);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/interval.mjs
|
|
function interval(start, end, options) {
|
|
const _start = toDate(start);
|
|
if (isNaN(+_start)) throw new TypeError("Start date is invalid");
|
|
const _end = toDate(end);
|
|
if (isNaN(+_end)) throw new TypeError("End date is invalid");
|
|
if ((options == null ? void 0 : options.assertPositive) && +_start > +_end)
|
|
throw new TypeError("End date must be after start date");
|
|
return { start: _start, end: _end };
|
|
}
|
|
|
|
// ../../node_modules/date-fns/intervalToDuration.mjs
|
|
function intervalToDuration(interval2) {
|
|
const start = toDate(interval2.start);
|
|
const end = toDate(interval2.end);
|
|
const duration = {};
|
|
const years = differenceInYears(end, start);
|
|
if (years) duration.years = years;
|
|
const remainingMonths = add(start, { years: duration.years });
|
|
const months2 = differenceInMonths(end, remainingMonths);
|
|
if (months2) duration.months = months2;
|
|
const remainingDays = add(remainingMonths, { months: duration.months });
|
|
const days2 = differenceInDays(end, remainingDays);
|
|
if (days2) duration.days = days2;
|
|
const remainingHours = add(remainingDays, { days: duration.days });
|
|
const hours = differenceInHours(end, remainingHours);
|
|
if (hours) duration.hours = hours;
|
|
const remainingMinutes = add(remainingHours, { hours: duration.hours });
|
|
const minutes = differenceInMinutes(end, remainingMinutes);
|
|
if (minutes) duration.minutes = minutes;
|
|
const remainingSeconds = add(remainingMinutes, { minutes: duration.minutes });
|
|
const seconds = differenceInSeconds(end, remainingSeconds);
|
|
if (seconds) duration.seconds = seconds;
|
|
return duration;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/intlFormat.mjs
|
|
function intlFormat(date, formatOrLocale, localeOptions) {
|
|
let formatOptions;
|
|
if (isFormatOptions(formatOrLocale)) {
|
|
formatOptions = formatOrLocale;
|
|
} else {
|
|
localeOptions = formatOrLocale;
|
|
}
|
|
return new Intl.DateTimeFormat(localeOptions == null ? void 0 : localeOptions.locale, formatOptions).format(
|
|
toDate(date)
|
|
);
|
|
}
|
|
function isFormatOptions(opts) {
|
|
return opts !== void 0 && !("locale" in opts);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/intlFormatDistance.mjs
|
|
function intlFormatDistance(date, baseDate, options) {
|
|
let value = 0;
|
|
let unit;
|
|
const dateLeft = toDate(date);
|
|
const dateRight = toDate(baseDate);
|
|
if (!(options == null ? void 0 : options.unit)) {
|
|
const diffInSeconds = differenceInSeconds(dateLeft, dateRight);
|
|
if (Math.abs(diffInSeconds) < secondsInMinute) {
|
|
value = differenceInSeconds(dateLeft, dateRight);
|
|
unit = "second";
|
|
} else if (Math.abs(diffInSeconds) < secondsInHour) {
|
|
value = differenceInMinutes(dateLeft, dateRight);
|
|
unit = "minute";
|
|
} else if (Math.abs(diffInSeconds) < secondsInDay && Math.abs(differenceInCalendarDays(dateLeft, dateRight)) < 1) {
|
|
value = differenceInHours(dateLeft, dateRight);
|
|
unit = "hour";
|
|
} else if (Math.abs(diffInSeconds) < secondsInWeek && (value = differenceInCalendarDays(dateLeft, dateRight)) && Math.abs(value) < 7) {
|
|
unit = "day";
|
|
} else if (Math.abs(diffInSeconds) < secondsInMonth) {
|
|
value = differenceInCalendarWeeks(dateLeft, dateRight);
|
|
unit = "week";
|
|
} else if (Math.abs(diffInSeconds) < secondsInQuarter) {
|
|
value = differenceInCalendarMonths(dateLeft, dateRight);
|
|
unit = "month";
|
|
} else if (Math.abs(diffInSeconds) < secondsInYear) {
|
|
if (differenceInCalendarQuarters(dateLeft, dateRight) < 4) {
|
|
value = differenceInCalendarQuarters(dateLeft, dateRight);
|
|
unit = "quarter";
|
|
} else {
|
|
value = differenceInCalendarYears(dateLeft, dateRight);
|
|
unit = "year";
|
|
}
|
|
} else {
|
|
value = differenceInCalendarYears(dateLeft, dateRight);
|
|
unit = "year";
|
|
}
|
|
} else {
|
|
unit = options == null ? void 0 : options.unit;
|
|
if (unit === "second") {
|
|
value = differenceInSeconds(dateLeft, dateRight);
|
|
} else if (unit === "minute") {
|
|
value = differenceInMinutes(dateLeft, dateRight);
|
|
} else if (unit === "hour") {
|
|
value = differenceInHours(dateLeft, dateRight);
|
|
} else if (unit === "day") {
|
|
value = differenceInCalendarDays(dateLeft, dateRight);
|
|
} else if (unit === "week") {
|
|
value = differenceInCalendarWeeks(dateLeft, dateRight);
|
|
} else if (unit === "month") {
|
|
value = differenceInCalendarMonths(dateLeft, dateRight);
|
|
} else if (unit === "quarter") {
|
|
value = differenceInCalendarQuarters(dateLeft, dateRight);
|
|
} else if (unit === "year") {
|
|
value = differenceInCalendarYears(dateLeft, dateRight);
|
|
}
|
|
}
|
|
const rtf = new Intl.RelativeTimeFormat(options == null ? void 0 : options.locale, {
|
|
localeMatcher: options == null ? void 0 : options.localeMatcher,
|
|
numeric: (options == null ? void 0 : options.numeric) || "auto",
|
|
style: options == null ? void 0 : options.style
|
|
});
|
|
return rtf.format(value, unit);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isAfter.mjs
|
|
function isAfter(date, dateToCompare) {
|
|
const _date = toDate(date);
|
|
const _dateToCompare = toDate(dateToCompare);
|
|
return _date.getTime() > _dateToCompare.getTime();
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isBefore.mjs
|
|
function isBefore(date, dateToCompare) {
|
|
const _date = toDate(date);
|
|
const _dateToCompare = toDate(dateToCompare);
|
|
return +_date < +_dateToCompare;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isEqual.mjs
|
|
function isEqual(leftDate, rightDate) {
|
|
const _dateLeft = toDate(leftDate);
|
|
const _dateRight = toDate(rightDate);
|
|
return +_dateLeft === +_dateRight;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isExists.mjs
|
|
function isExists(year, month, day) {
|
|
const date = new Date(year, month, day);
|
|
return date.getFullYear() === year && date.getMonth() === month && date.getDate() === day;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isFirstDayOfMonth.mjs
|
|
function isFirstDayOfMonth(date) {
|
|
return toDate(date).getDate() === 1;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isFriday.mjs
|
|
function isFriday(date) {
|
|
return toDate(date).getDay() === 5;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isFuture.mjs
|
|
function isFuture(date) {
|
|
return +toDate(date) > Date.now();
|
|
}
|
|
|
|
// ../../node_modules/date-fns/transpose.mjs
|
|
function transpose(fromDate, constructor) {
|
|
const date = constructor instanceof Date ? constructFrom(constructor, 0) : new constructor(0);
|
|
date.setFullYear(
|
|
fromDate.getFullYear(),
|
|
fromDate.getMonth(),
|
|
fromDate.getDate()
|
|
);
|
|
date.setHours(
|
|
fromDate.getHours(),
|
|
fromDate.getMinutes(),
|
|
fromDate.getSeconds(),
|
|
fromDate.getMilliseconds()
|
|
);
|
|
return date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/Setter.mjs
|
|
var TIMEZONE_UNIT_PRIORITY = 10;
|
|
var Setter = class {
|
|
constructor() {
|
|
__publicField(this, "subPriority", 0);
|
|
}
|
|
validate(_utcDate, _options) {
|
|
return true;
|
|
}
|
|
};
|
|
var ValueSetter = class extends Setter {
|
|
constructor(value, validateValue, setValue, priority, subPriority) {
|
|
super();
|
|
this.value = value;
|
|
this.validateValue = validateValue;
|
|
this.setValue = setValue;
|
|
this.priority = priority;
|
|
if (subPriority) {
|
|
this.subPriority = subPriority;
|
|
}
|
|
}
|
|
validate(date, options) {
|
|
return this.validateValue(date, this.value, options);
|
|
}
|
|
set(date, flags, options) {
|
|
return this.setValue(date, flags, this.value, options);
|
|
}
|
|
};
|
|
var DateToSystemTimezoneSetter = class extends Setter {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", TIMEZONE_UNIT_PRIORITY);
|
|
__publicField(this, "subPriority", -1);
|
|
}
|
|
set(date, flags) {
|
|
if (flags.timestampIsSet) return date;
|
|
return constructFrom(date, transpose(date, Date));
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/Parser.mjs
|
|
var Parser = class {
|
|
run(dateString, token, match2, options) {
|
|
const result = this.parse(dateString, token, match2, options);
|
|
if (!result) {
|
|
return null;
|
|
}
|
|
return {
|
|
setter: new ValueSetter(
|
|
result.value,
|
|
this.validate,
|
|
this.set,
|
|
this.priority,
|
|
this.subPriority
|
|
),
|
|
rest: result.rest
|
|
};
|
|
}
|
|
validate(_utcDate, _value, _options) {
|
|
return true;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/EraParser.mjs
|
|
var EraParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 140);
|
|
__publicField(this, "incompatibleTokens", ["R", "u", "t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "G":
|
|
case "GG":
|
|
case "GGG":
|
|
return match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
|
|
case "GGGGG":
|
|
return match2.era(dateString, { width: "narrow" });
|
|
case "GGGG":
|
|
default:
|
|
return match2.era(dateString, { width: "wide" }) || match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
|
|
}
|
|
}
|
|
set(date, flags, value) {
|
|
flags.era = value;
|
|
date.setFullYear(value, 0, 1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/constants.mjs
|
|
var numericPatterns = {
|
|
month: /^(1[0-2]|0?\d)/,
|
|
// 0 to 12
|
|
date: /^(3[0-1]|[0-2]?\d)/,
|
|
// 0 to 31
|
|
dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
|
|
// 0 to 366
|
|
week: /^(5[0-3]|[0-4]?\d)/,
|
|
// 0 to 53
|
|
hour23h: /^(2[0-3]|[0-1]?\d)/,
|
|
// 0 to 23
|
|
hour24h: /^(2[0-4]|[0-1]?\d)/,
|
|
// 0 to 24
|
|
hour11h: /^(1[0-1]|0?\d)/,
|
|
// 0 to 11
|
|
hour12h: /^(1[0-2]|0?\d)/,
|
|
// 0 to 12
|
|
minute: /^[0-5]?\d/,
|
|
// 0 to 59
|
|
second: /^[0-5]?\d/,
|
|
// 0 to 59
|
|
singleDigit: /^\d/,
|
|
// 0 to 9
|
|
twoDigits: /^\d{1,2}/,
|
|
// 0 to 99
|
|
threeDigits: /^\d{1,3}/,
|
|
// 0 to 999
|
|
fourDigits: /^\d{1,4}/,
|
|
// 0 to 9999
|
|
anyDigitsSigned: /^-?\d+/,
|
|
singleDigitSigned: /^-?\d/,
|
|
// 0 to 9, -0 to -9
|
|
twoDigitsSigned: /^-?\d{1,2}/,
|
|
// 0 to 99, -0 to -99
|
|
threeDigitsSigned: /^-?\d{1,3}/,
|
|
// 0 to 999, -0 to -999
|
|
fourDigitsSigned: /^-?\d{1,4}/
|
|
// 0 to 9999, -0 to -9999
|
|
};
|
|
var timezonePatterns = {
|
|
basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
|
basic: /^([+-])(\d{2})(\d{2})|Z/,
|
|
basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
|
extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
|
extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/utils.mjs
|
|
function mapValue(parseFnResult, mapFn) {
|
|
if (!parseFnResult) {
|
|
return parseFnResult;
|
|
}
|
|
return {
|
|
value: mapFn(parseFnResult.value),
|
|
rest: parseFnResult.rest
|
|
};
|
|
}
|
|
function parseNumericPattern(pattern, dateString) {
|
|
const matchResult = dateString.match(pattern);
|
|
if (!matchResult) {
|
|
return null;
|
|
}
|
|
return {
|
|
value: parseInt(matchResult[0], 10),
|
|
rest: dateString.slice(matchResult[0].length)
|
|
};
|
|
}
|
|
function parseTimezonePattern(pattern, dateString) {
|
|
const matchResult = dateString.match(pattern);
|
|
if (!matchResult) {
|
|
return null;
|
|
}
|
|
if (matchResult[0] === "Z") {
|
|
return {
|
|
value: 0,
|
|
rest: dateString.slice(1)
|
|
};
|
|
}
|
|
const sign = matchResult[1] === "+" ? 1 : -1;
|
|
const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
|
|
const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
|
|
const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
|
|
return {
|
|
value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
|
|
rest: dateString.slice(matchResult[0].length)
|
|
};
|
|
}
|
|
function parseAnyDigitsSigned(dateString) {
|
|
return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
|
|
}
|
|
function parseNDigits(n, dateString) {
|
|
switch (n) {
|
|
case 1:
|
|
return parseNumericPattern(numericPatterns.singleDigit, dateString);
|
|
case 2:
|
|
return parseNumericPattern(numericPatterns.twoDigits, dateString);
|
|
case 3:
|
|
return parseNumericPattern(numericPatterns.threeDigits, dateString);
|
|
case 4:
|
|
return parseNumericPattern(numericPatterns.fourDigits, dateString);
|
|
default:
|
|
return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString);
|
|
}
|
|
}
|
|
function parseNDigitsSigned(n, dateString) {
|
|
switch (n) {
|
|
case 1:
|
|
return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
|
|
case 2:
|
|
return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
|
|
case 3:
|
|
return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
|
|
case 4:
|
|
return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
|
|
default:
|
|
return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString);
|
|
}
|
|
}
|
|
function dayPeriodEnumToHours(dayPeriod) {
|
|
switch (dayPeriod) {
|
|
case "morning":
|
|
return 4;
|
|
case "evening":
|
|
return 17;
|
|
case "pm":
|
|
case "noon":
|
|
case "afternoon":
|
|
return 12;
|
|
case "am":
|
|
case "midnight":
|
|
case "night":
|
|
default:
|
|
return 0;
|
|
}
|
|
}
|
|
function normalizeTwoDigitYear(twoDigitYear, currentYear) {
|
|
const isCommonEra = currentYear > 0;
|
|
const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
|
|
let result;
|
|
if (absCurrentYear <= 50) {
|
|
result = twoDigitYear || 100;
|
|
} else {
|
|
const rangeEnd = absCurrentYear + 50;
|
|
const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
|
|
const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
|
|
result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
|
|
}
|
|
return isCommonEra ? result : 1 - result;
|
|
}
|
|
function isLeapYearIndex(year) {
|
|
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/YearParser.mjs
|
|
var YearParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 130);
|
|
__publicField(this, "incompatibleTokens", ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
const valueCallback = (year) => ({
|
|
year,
|
|
isTwoDigitYear: token === "yy"
|
|
});
|
|
switch (token) {
|
|
case "y":
|
|
return mapValue(parseNDigits(4, dateString), valueCallback);
|
|
case "yo":
|
|
return mapValue(
|
|
match2.ordinalNumber(dateString, {
|
|
unit: "year"
|
|
}),
|
|
valueCallback
|
|
);
|
|
default:
|
|
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value.isTwoDigitYear || value.year > 0;
|
|
}
|
|
set(date, flags, value) {
|
|
const currentYear = date.getFullYear();
|
|
if (value.isTwoDigitYear) {
|
|
const normalizedTwoDigitYear = normalizeTwoDigitYear(
|
|
value.year,
|
|
currentYear
|
|
);
|
|
date.setFullYear(normalizedTwoDigitYear, 0, 1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
|
date.setFullYear(year, 0, 1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.mjs
|
|
var LocalWeekYearParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 130);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"y",
|
|
"R",
|
|
"u",
|
|
"Q",
|
|
"q",
|
|
"M",
|
|
"L",
|
|
"I",
|
|
"d",
|
|
"D",
|
|
"i",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
const valueCallback = (year) => ({
|
|
year,
|
|
isTwoDigitYear: token === "YY"
|
|
});
|
|
switch (token) {
|
|
case "Y":
|
|
return mapValue(parseNDigits(4, dateString), valueCallback);
|
|
case "Yo":
|
|
return mapValue(
|
|
match2.ordinalNumber(dateString, {
|
|
unit: "year"
|
|
}),
|
|
valueCallback
|
|
);
|
|
default:
|
|
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value.isTwoDigitYear || value.year > 0;
|
|
}
|
|
set(date, flags, value, options) {
|
|
const currentYear = getWeekYear(date, options);
|
|
if (value.isTwoDigitYear) {
|
|
const normalizedTwoDigitYear = normalizeTwoDigitYear(
|
|
value.year,
|
|
currentYear
|
|
);
|
|
date.setFullYear(
|
|
normalizedTwoDigitYear,
|
|
0,
|
|
options.firstWeekContainsDate
|
|
);
|
|
date.setHours(0, 0, 0, 0);
|
|
return startOfWeek(date, options);
|
|
}
|
|
const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
|
date.setFullYear(year, 0, options.firstWeekContainsDate);
|
|
date.setHours(0, 0, 0, 0);
|
|
return startOfWeek(date, options);
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.mjs
|
|
var ISOWeekYearParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 130);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"G",
|
|
"y",
|
|
"Y",
|
|
"u",
|
|
"Q",
|
|
"q",
|
|
"M",
|
|
"L",
|
|
"w",
|
|
"d",
|
|
"D",
|
|
"e",
|
|
"c",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token) {
|
|
if (token === "R") {
|
|
return parseNDigitsSigned(4, dateString);
|
|
}
|
|
return parseNDigitsSigned(token.length, dateString);
|
|
}
|
|
set(date, _flags, value) {
|
|
const firstWeekOfYear = constructFrom(date, 0);
|
|
firstWeekOfYear.setFullYear(value, 0, 4);
|
|
firstWeekOfYear.setHours(0, 0, 0, 0);
|
|
return startOfISOWeek(firstWeekOfYear);
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.mjs
|
|
var ExtendedYearParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 130);
|
|
__publicField(this, "incompatibleTokens", ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]);
|
|
}
|
|
parse(dateString, token) {
|
|
if (token === "u") {
|
|
return parseNDigitsSigned(4, dateString);
|
|
}
|
|
return parseNDigitsSigned(token.length, dateString);
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setFullYear(value, 0, 1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/QuarterParser.mjs
|
|
var QuarterParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 120);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"Y",
|
|
"R",
|
|
"q",
|
|
"M",
|
|
"L",
|
|
"w",
|
|
"I",
|
|
"d",
|
|
"D",
|
|
"i",
|
|
"e",
|
|
"c",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "Q":
|
|
case "QQ":
|
|
return parseNDigits(token.length, dateString);
|
|
case "Qo":
|
|
return match2.ordinalNumber(dateString, { unit: "quarter" });
|
|
case "QQQ":
|
|
return match2.quarter(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.quarter(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "QQQQQ":
|
|
return match2.quarter(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "QQQQ":
|
|
default:
|
|
return match2.quarter(dateString, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
}) || match2.quarter(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.quarter(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 1 && value <= 4;
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setMonth((value - 1) * 3, 1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.mjs
|
|
var StandAloneQuarterParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 120);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"Y",
|
|
"R",
|
|
"Q",
|
|
"M",
|
|
"L",
|
|
"w",
|
|
"I",
|
|
"d",
|
|
"D",
|
|
"i",
|
|
"e",
|
|
"c",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "q":
|
|
case "qq":
|
|
return parseNDigits(token.length, dateString);
|
|
case "qo":
|
|
return match2.ordinalNumber(dateString, { unit: "quarter" });
|
|
case "qqq":
|
|
return match2.quarter(dateString, {
|
|
width: "abbreviated",
|
|
context: "standalone"
|
|
}) || match2.quarter(dateString, {
|
|
width: "narrow",
|
|
context: "standalone"
|
|
});
|
|
case "qqqqq":
|
|
return match2.quarter(dateString, {
|
|
width: "narrow",
|
|
context: "standalone"
|
|
});
|
|
case "qqqq":
|
|
default:
|
|
return match2.quarter(dateString, {
|
|
width: "wide",
|
|
context: "standalone"
|
|
}) || match2.quarter(dateString, {
|
|
width: "abbreviated",
|
|
context: "standalone"
|
|
}) || match2.quarter(dateString, {
|
|
width: "narrow",
|
|
context: "standalone"
|
|
});
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 1 && value <= 4;
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setMonth((value - 1) * 3, 1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/MonthParser.mjs
|
|
var MonthParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"Y",
|
|
"R",
|
|
"q",
|
|
"Q",
|
|
"L",
|
|
"w",
|
|
"I",
|
|
"D",
|
|
"i",
|
|
"e",
|
|
"c",
|
|
"t",
|
|
"T"
|
|
]);
|
|
__publicField(this, "priority", 110);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
const valueCallback = (value) => value - 1;
|
|
switch (token) {
|
|
case "M":
|
|
return mapValue(
|
|
parseNumericPattern(numericPatterns.month, dateString),
|
|
valueCallback
|
|
);
|
|
case "MM":
|
|
return mapValue(parseNDigits(2, dateString), valueCallback);
|
|
case "Mo":
|
|
return mapValue(
|
|
match2.ordinalNumber(dateString, {
|
|
unit: "month"
|
|
}),
|
|
valueCallback
|
|
);
|
|
case "MMM":
|
|
return match2.month(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.month(dateString, { width: "narrow", context: "formatting" });
|
|
case "MMMMM":
|
|
return match2.month(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "MMMM":
|
|
default:
|
|
return match2.month(dateString, { width: "wide", context: "formatting" }) || match2.month(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.month(dateString, { width: "narrow", context: "formatting" });
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 0 && value <= 11;
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setMonth(value, 1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.mjs
|
|
var StandAloneMonthParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 110);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"Y",
|
|
"R",
|
|
"q",
|
|
"Q",
|
|
"M",
|
|
"w",
|
|
"I",
|
|
"D",
|
|
"i",
|
|
"e",
|
|
"c",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
const valueCallback = (value) => value - 1;
|
|
switch (token) {
|
|
case "L":
|
|
return mapValue(
|
|
parseNumericPattern(numericPatterns.month, dateString),
|
|
valueCallback
|
|
);
|
|
case "LL":
|
|
return mapValue(parseNDigits(2, dateString), valueCallback);
|
|
case "Lo":
|
|
return mapValue(
|
|
match2.ordinalNumber(dateString, {
|
|
unit: "month"
|
|
}),
|
|
valueCallback
|
|
);
|
|
case "LLL":
|
|
return match2.month(dateString, {
|
|
width: "abbreviated",
|
|
context: "standalone"
|
|
}) || match2.month(dateString, { width: "narrow", context: "standalone" });
|
|
case "LLLLL":
|
|
return match2.month(dateString, {
|
|
width: "narrow",
|
|
context: "standalone"
|
|
});
|
|
case "LLLL":
|
|
default:
|
|
return match2.month(dateString, { width: "wide", context: "standalone" }) || match2.month(dateString, {
|
|
width: "abbreviated",
|
|
context: "standalone"
|
|
}) || match2.month(dateString, { width: "narrow", context: "standalone" });
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 0 && value <= 11;
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setMonth(value, 1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/setWeek.mjs
|
|
function setWeek(date, week, options) {
|
|
const _date = toDate(date);
|
|
const diff = getWeek(_date, options) - week;
|
|
_date.setDate(_date.getDate() - diff * 7);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.mjs
|
|
var LocalWeekParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 100);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"y",
|
|
"R",
|
|
"u",
|
|
"q",
|
|
"Q",
|
|
"M",
|
|
"L",
|
|
"I",
|
|
"d",
|
|
"D",
|
|
"i",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "w":
|
|
return parseNumericPattern(numericPatterns.week, dateString);
|
|
case "wo":
|
|
return match2.ordinalNumber(dateString, { unit: "week" });
|
|
default:
|
|
return parseNDigits(token.length, dateString);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 1 && value <= 53;
|
|
}
|
|
set(date, _flags, value, options) {
|
|
return startOfWeek(setWeek(date, value, options), options);
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/setISOWeek.mjs
|
|
function setISOWeek(date, week) {
|
|
const _date = toDate(date);
|
|
const diff = getISOWeek(_date) - week;
|
|
_date.setDate(_date.getDate() - diff * 7);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.mjs
|
|
var ISOWeekParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 100);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"y",
|
|
"Y",
|
|
"u",
|
|
"q",
|
|
"Q",
|
|
"M",
|
|
"L",
|
|
"w",
|
|
"d",
|
|
"D",
|
|
"e",
|
|
"c",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "I":
|
|
return parseNumericPattern(numericPatterns.week, dateString);
|
|
case "Io":
|
|
return match2.ordinalNumber(dateString, { unit: "week" });
|
|
default:
|
|
return parseNDigits(token.length, dateString);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 1 && value <= 53;
|
|
}
|
|
set(date, _flags, value) {
|
|
return startOfISOWeek(setISOWeek(date, value));
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/DateParser.mjs
|
|
var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
var DAYS_IN_MONTH_LEAP_YEAR = [
|
|
31,
|
|
29,
|
|
31,
|
|
30,
|
|
31,
|
|
30,
|
|
31,
|
|
31,
|
|
30,
|
|
31,
|
|
30,
|
|
31
|
|
];
|
|
var DateParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 90);
|
|
__publicField(this, "subPriority", 1);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"Y",
|
|
"R",
|
|
"q",
|
|
"Q",
|
|
"w",
|
|
"I",
|
|
"D",
|
|
"i",
|
|
"e",
|
|
"c",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "d":
|
|
return parseNumericPattern(numericPatterns.date, dateString);
|
|
case "do":
|
|
return match2.ordinalNumber(dateString, { unit: "date" });
|
|
default:
|
|
return parseNDigits(token.length, dateString);
|
|
}
|
|
}
|
|
validate(date, value) {
|
|
const year = date.getFullYear();
|
|
const isLeapYear2 = isLeapYearIndex(year);
|
|
const month = date.getMonth();
|
|
if (isLeapYear2) {
|
|
return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
|
|
} else {
|
|
return value >= 1 && value <= DAYS_IN_MONTH[month];
|
|
}
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setDate(value);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.mjs
|
|
var DayOfYearParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 90);
|
|
__publicField(this, "subpriority", 1);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"Y",
|
|
"R",
|
|
"q",
|
|
"Q",
|
|
"M",
|
|
"L",
|
|
"w",
|
|
"I",
|
|
"d",
|
|
"E",
|
|
"i",
|
|
"e",
|
|
"c",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "D":
|
|
case "DD":
|
|
return parseNumericPattern(numericPatterns.dayOfYear, dateString);
|
|
case "Do":
|
|
return match2.ordinalNumber(dateString, { unit: "date" });
|
|
default:
|
|
return parseNDigits(token.length, dateString);
|
|
}
|
|
}
|
|
validate(date, value) {
|
|
const year = date.getFullYear();
|
|
const isLeapYear2 = isLeapYearIndex(year);
|
|
if (isLeapYear2) {
|
|
return value >= 1 && value <= 366;
|
|
} else {
|
|
return value >= 1 && value <= 365;
|
|
}
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setMonth(0, value);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/setDay.mjs
|
|
function setDay(date, day, options) {
|
|
var _a, _b, _c, _d;
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
|
const _date = toDate(date);
|
|
const currentDay = _date.getDay();
|
|
const remainder = day % 7;
|
|
const dayIndex = (remainder + 7) % 7;
|
|
const delta = 7 - weekStartsOn;
|
|
const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;
|
|
return addDays(_date, diff);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/DayParser.mjs
|
|
var DayParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 90);
|
|
__publicField(this, "incompatibleTokens", ["D", "i", "e", "c", "t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "E":
|
|
case "EE":
|
|
case "EEE":
|
|
return match2.day(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
|
case "EEEEE":
|
|
return match2.day(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "EEEEEE":
|
|
return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
|
case "EEEE":
|
|
default:
|
|
return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 0 && value <= 6;
|
|
}
|
|
set(date, _flags, value, options) {
|
|
date = setDay(date, value, options);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/LocalDayParser.mjs
|
|
var LocalDayParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 90);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"y",
|
|
"R",
|
|
"u",
|
|
"q",
|
|
"Q",
|
|
"M",
|
|
"L",
|
|
"I",
|
|
"d",
|
|
"D",
|
|
"E",
|
|
"i",
|
|
"c",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2, options) {
|
|
const valueCallback = (value) => {
|
|
const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
|
|
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
|
|
};
|
|
switch (token) {
|
|
case "e":
|
|
case "ee":
|
|
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
case "eo":
|
|
return mapValue(
|
|
match2.ordinalNumber(dateString, {
|
|
unit: "day"
|
|
}),
|
|
valueCallback
|
|
);
|
|
case "eee":
|
|
return match2.day(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
|
case "eeeee":
|
|
return match2.day(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "eeeeee":
|
|
return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
|
case "eeee":
|
|
default:
|
|
return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 0 && value <= 6;
|
|
}
|
|
set(date, _flags, value, options) {
|
|
date = setDay(date, value, options);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.mjs
|
|
var StandAloneLocalDayParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 90);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"y",
|
|
"R",
|
|
"u",
|
|
"q",
|
|
"Q",
|
|
"M",
|
|
"L",
|
|
"I",
|
|
"d",
|
|
"D",
|
|
"E",
|
|
"i",
|
|
"e",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2, options) {
|
|
const valueCallback = (value) => {
|
|
const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
|
|
return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
|
|
};
|
|
switch (token) {
|
|
case "c":
|
|
case "cc":
|
|
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
case "co":
|
|
return mapValue(
|
|
match2.ordinalNumber(dateString, {
|
|
unit: "day"
|
|
}),
|
|
valueCallback
|
|
);
|
|
case "ccc":
|
|
return match2.day(dateString, {
|
|
width: "abbreviated",
|
|
context: "standalone"
|
|
}) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
|
|
case "ccccc":
|
|
return match2.day(dateString, {
|
|
width: "narrow",
|
|
context: "standalone"
|
|
});
|
|
case "cccccc":
|
|
return match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
|
|
case "cccc":
|
|
default:
|
|
return match2.day(dateString, { width: "wide", context: "standalone" }) || match2.day(dateString, {
|
|
width: "abbreviated",
|
|
context: "standalone"
|
|
}) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 0 && value <= 6;
|
|
}
|
|
set(date, _flags, value, options) {
|
|
date = setDay(date, value, options);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/setISODay.mjs
|
|
function setISODay(date, day) {
|
|
const _date = toDate(date);
|
|
const currentDay = getISODay(_date);
|
|
const diff = day - currentDay;
|
|
return addDays(_date, diff);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/ISODayParser.mjs
|
|
var ISODayParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 90);
|
|
__publicField(this, "incompatibleTokens", [
|
|
"y",
|
|
"Y",
|
|
"u",
|
|
"q",
|
|
"Q",
|
|
"M",
|
|
"L",
|
|
"w",
|
|
"d",
|
|
"D",
|
|
"E",
|
|
"e",
|
|
"c",
|
|
"t",
|
|
"T"
|
|
]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
const valueCallback = (value) => {
|
|
if (value === 0) {
|
|
return 7;
|
|
}
|
|
return value;
|
|
};
|
|
switch (token) {
|
|
case "i":
|
|
case "ii":
|
|
return parseNDigits(token.length, dateString);
|
|
case "io":
|
|
return match2.ordinalNumber(dateString, { unit: "day" });
|
|
case "iii":
|
|
return mapValue(
|
|
match2.day(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.day(dateString, {
|
|
width: "short",
|
|
context: "formatting"
|
|
}) || match2.day(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
}),
|
|
valueCallback
|
|
);
|
|
case "iiiii":
|
|
return mapValue(
|
|
match2.day(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
}),
|
|
valueCallback
|
|
);
|
|
case "iiiiii":
|
|
return mapValue(
|
|
match2.day(dateString, {
|
|
width: "short",
|
|
context: "formatting"
|
|
}) || match2.day(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
}),
|
|
valueCallback
|
|
);
|
|
case "iiii":
|
|
default:
|
|
return mapValue(
|
|
match2.day(dateString, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
}) || match2.day(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.day(dateString, {
|
|
width: "short",
|
|
context: "formatting"
|
|
}) || match2.day(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
}),
|
|
valueCallback
|
|
);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 1 && value <= 7;
|
|
}
|
|
set(date, _flags, value) {
|
|
date = setISODay(date, value);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/AMPMParser.mjs
|
|
var AMPMParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 80);
|
|
__publicField(this, "incompatibleTokens", ["b", "B", "H", "k", "t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "a":
|
|
case "aa":
|
|
case "aaa":
|
|
return match2.dayPeriod(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.dayPeriod(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "aaaaa":
|
|
return match2.dayPeriod(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "aaaa":
|
|
default:
|
|
return match2.dayPeriod(dateString, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
}) || match2.dayPeriod(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.dayPeriod(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.mjs
|
|
var AMPMMidnightParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 80);
|
|
__publicField(this, "incompatibleTokens", ["a", "B", "H", "k", "t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "b":
|
|
case "bb":
|
|
case "bbb":
|
|
return match2.dayPeriod(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.dayPeriod(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "bbbbb":
|
|
return match2.dayPeriod(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "bbbb":
|
|
default:
|
|
return match2.dayPeriod(dateString, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
}) || match2.dayPeriod(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.dayPeriod(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.mjs
|
|
var DayPeriodParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 80);
|
|
__publicField(this, "incompatibleTokens", ["a", "b", "t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "B":
|
|
case "BB":
|
|
case "BBB":
|
|
return match2.dayPeriod(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.dayPeriod(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "BBBBB":
|
|
return match2.dayPeriod(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
case "BBBB":
|
|
default:
|
|
return match2.dayPeriod(dateString, {
|
|
width: "wide",
|
|
context: "formatting"
|
|
}) || match2.dayPeriod(dateString, {
|
|
width: "abbreviated",
|
|
context: "formatting"
|
|
}) || match2.dayPeriod(dateString, {
|
|
width: "narrow",
|
|
context: "formatting"
|
|
});
|
|
}
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.mjs
|
|
var Hour1to12Parser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 70);
|
|
__publicField(this, "incompatibleTokens", ["H", "K", "k", "t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "h":
|
|
return parseNumericPattern(numericPatterns.hour12h, dateString);
|
|
case "ho":
|
|
return match2.ordinalNumber(dateString, { unit: "hour" });
|
|
default:
|
|
return parseNDigits(token.length, dateString);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 1 && value <= 12;
|
|
}
|
|
set(date, _flags, value) {
|
|
const isPM = date.getHours() >= 12;
|
|
if (isPM && value < 12) {
|
|
date.setHours(value + 12, 0, 0, 0);
|
|
} else if (!isPM && value === 12) {
|
|
date.setHours(0, 0, 0, 0);
|
|
} else {
|
|
date.setHours(value, 0, 0, 0);
|
|
}
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.mjs
|
|
var Hour0to23Parser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 70);
|
|
__publicField(this, "incompatibleTokens", ["a", "b", "h", "K", "k", "t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "H":
|
|
return parseNumericPattern(numericPatterns.hour23h, dateString);
|
|
case "Ho":
|
|
return match2.ordinalNumber(dateString, { unit: "hour" });
|
|
default:
|
|
return parseNDigits(token.length, dateString);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 0 && value <= 23;
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setHours(value, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.mjs
|
|
var Hour0To11Parser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 70);
|
|
__publicField(this, "incompatibleTokens", ["h", "H", "k", "t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "K":
|
|
return parseNumericPattern(numericPatterns.hour11h, dateString);
|
|
case "Ko":
|
|
return match2.ordinalNumber(dateString, { unit: "hour" });
|
|
default:
|
|
return parseNDigits(token.length, dateString);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 0 && value <= 11;
|
|
}
|
|
set(date, _flags, value) {
|
|
const isPM = date.getHours() >= 12;
|
|
if (isPM && value < 12) {
|
|
date.setHours(value + 12, 0, 0, 0);
|
|
} else {
|
|
date.setHours(value, 0, 0, 0);
|
|
}
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.mjs
|
|
var Hour1To24Parser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 70);
|
|
__publicField(this, "incompatibleTokens", ["a", "b", "h", "H", "K", "t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "k":
|
|
return parseNumericPattern(numericPatterns.hour24h, dateString);
|
|
case "ko":
|
|
return match2.ordinalNumber(dateString, { unit: "hour" });
|
|
default:
|
|
return parseNDigits(token.length, dateString);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 1 && value <= 24;
|
|
}
|
|
set(date, _flags, value) {
|
|
const hours = value <= 24 ? value % 24 : value;
|
|
date.setHours(hours, 0, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/MinuteParser.mjs
|
|
var MinuteParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 60);
|
|
__publicField(this, "incompatibleTokens", ["t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "m":
|
|
return parseNumericPattern(numericPatterns.minute, dateString);
|
|
case "mo":
|
|
return match2.ordinalNumber(dateString, { unit: "minute" });
|
|
default:
|
|
return parseNDigits(token.length, dateString);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 0 && value <= 59;
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setMinutes(value, 0, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/SecondParser.mjs
|
|
var SecondParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 50);
|
|
__publicField(this, "incompatibleTokens", ["t", "T"]);
|
|
}
|
|
parse(dateString, token, match2) {
|
|
switch (token) {
|
|
case "s":
|
|
return parseNumericPattern(numericPatterns.second, dateString);
|
|
case "so":
|
|
return match2.ordinalNumber(dateString, { unit: "second" });
|
|
default:
|
|
return parseNDigits(token.length, dateString);
|
|
}
|
|
}
|
|
validate(_date, value) {
|
|
return value >= 0 && value <= 59;
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setSeconds(value, 0);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.mjs
|
|
var FractionOfSecondParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 30);
|
|
__publicField(this, "incompatibleTokens", ["t", "T"]);
|
|
}
|
|
parse(dateString, token) {
|
|
const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3));
|
|
return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
|
}
|
|
set(date, _flags, value) {
|
|
date.setMilliseconds(value);
|
|
return date;
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.mjs
|
|
var ISOTimezoneWithZParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 10);
|
|
__publicField(this, "incompatibleTokens", ["t", "T", "x"]);
|
|
}
|
|
parse(dateString, token) {
|
|
switch (token) {
|
|
case "X":
|
|
return parseTimezonePattern(
|
|
timezonePatterns.basicOptionalMinutes,
|
|
dateString
|
|
);
|
|
case "XX":
|
|
return parseTimezonePattern(timezonePatterns.basic, dateString);
|
|
case "XXXX":
|
|
return parseTimezonePattern(
|
|
timezonePatterns.basicOptionalSeconds,
|
|
dateString
|
|
);
|
|
case "XXXXX":
|
|
return parseTimezonePattern(
|
|
timezonePatterns.extendedOptionalSeconds,
|
|
dateString
|
|
);
|
|
case "XXX":
|
|
default:
|
|
return parseTimezonePattern(timezonePatterns.extended, dateString);
|
|
}
|
|
}
|
|
set(date, flags, value) {
|
|
if (flags.timestampIsSet) return date;
|
|
return constructFrom(
|
|
date,
|
|
date.getTime() - getTimezoneOffsetInMilliseconds(date) - value
|
|
);
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.mjs
|
|
var ISOTimezoneParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 10);
|
|
__publicField(this, "incompatibleTokens", ["t", "T", "X"]);
|
|
}
|
|
parse(dateString, token) {
|
|
switch (token) {
|
|
case "x":
|
|
return parseTimezonePattern(
|
|
timezonePatterns.basicOptionalMinutes,
|
|
dateString
|
|
);
|
|
case "xx":
|
|
return parseTimezonePattern(timezonePatterns.basic, dateString);
|
|
case "xxxx":
|
|
return parseTimezonePattern(
|
|
timezonePatterns.basicOptionalSeconds,
|
|
dateString
|
|
);
|
|
case "xxxxx":
|
|
return parseTimezonePattern(
|
|
timezonePatterns.extendedOptionalSeconds,
|
|
dateString
|
|
);
|
|
case "xxx":
|
|
default:
|
|
return parseTimezonePattern(timezonePatterns.extended, dateString);
|
|
}
|
|
}
|
|
set(date, flags, value) {
|
|
if (flags.timestampIsSet) return date;
|
|
return constructFrom(
|
|
date,
|
|
date.getTime() - getTimezoneOffsetInMilliseconds(date) - value
|
|
);
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.mjs
|
|
var TimestampSecondsParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 40);
|
|
__publicField(this, "incompatibleTokens", "*");
|
|
}
|
|
parse(dateString) {
|
|
return parseAnyDigitsSigned(dateString);
|
|
}
|
|
set(date, _flags, value) {
|
|
return [constructFrom(date, value * 1e3), { timestampIsSet: true }];
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.mjs
|
|
var TimestampMillisecondsParser = class extends Parser {
|
|
constructor() {
|
|
super(...arguments);
|
|
__publicField(this, "priority", 20);
|
|
__publicField(this, "incompatibleTokens", "*");
|
|
}
|
|
parse(dateString) {
|
|
return parseAnyDigitsSigned(dateString);
|
|
}
|
|
set(date, _flags, value) {
|
|
return [constructFrom(date, value), { timestampIsSet: true }];
|
|
}
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse/_lib/parsers.mjs
|
|
var parsers = {
|
|
G: new EraParser(),
|
|
y: new YearParser(),
|
|
Y: new LocalWeekYearParser(),
|
|
R: new ISOWeekYearParser(),
|
|
u: new ExtendedYearParser(),
|
|
Q: new QuarterParser(),
|
|
q: new StandAloneQuarterParser(),
|
|
M: new MonthParser(),
|
|
L: new StandAloneMonthParser(),
|
|
w: new LocalWeekParser(),
|
|
I: new ISOWeekParser(),
|
|
d: new DateParser(),
|
|
D: new DayOfYearParser(),
|
|
E: new DayParser(),
|
|
e: new LocalDayParser(),
|
|
c: new StandAloneLocalDayParser(),
|
|
i: new ISODayParser(),
|
|
a: new AMPMParser(),
|
|
b: new AMPMMidnightParser(),
|
|
B: new DayPeriodParser(),
|
|
h: new Hour1to12Parser(),
|
|
H: new Hour0to23Parser(),
|
|
K: new Hour0To11Parser(),
|
|
k: new Hour1To24Parser(),
|
|
m: new MinuteParser(),
|
|
s: new SecondParser(),
|
|
S: new FractionOfSecondParser(),
|
|
X: new ISOTimezoneWithZParser(),
|
|
x: new ISOTimezoneParser(),
|
|
t: new TimestampSecondsParser(),
|
|
T: new TimestampMillisecondsParser()
|
|
};
|
|
|
|
// ../../node_modules/date-fns/parse.mjs
|
|
var formattingTokensRegExp2 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
var longFormattingTokensRegExp2 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
var escapedStringRegExp2 = /^'([^]*?)'?$/;
|
|
var doubleQuoteRegExp2 = /''/g;
|
|
var notWhitespaceRegExp = /\S/;
|
|
var unescapedLatinCharacterRegExp2 = /[a-zA-Z]/;
|
|
function parse(dateStr, formatStr, referenceDate, options) {
|
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
const defaultOptions2 = getDefaultOptions2();
|
|
const locale = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
|
|
const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
|
|
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_f = (_e = options == null ? void 0 : options.locale) == null ? void 0 : _e.options) == null ? void 0 : _f.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_h = (_g = defaultOptions2.locale) == null ? void 0 : _g.options) == null ? void 0 : _h.weekStartsOn) ?? 0;
|
|
if (formatStr === "") {
|
|
if (dateStr === "") {
|
|
return toDate(referenceDate);
|
|
} else {
|
|
return constructFrom(referenceDate, NaN);
|
|
}
|
|
}
|
|
const subFnOptions = {
|
|
firstWeekContainsDate,
|
|
weekStartsOn,
|
|
locale
|
|
};
|
|
const setters = [new DateToSystemTimezoneSetter()];
|
|
const tokens = formatStr.match(longFormattingTokensRegExp2).map((substring) => {
|
|
const firstCharacter = substring[0];
|
|
if (firstCharacter in longFormatters) {
|
|
const longFormatter = longFormatters[firstCharacter];
|
|
return longFormatter(substring, locale.formatLong);
|
|
}
|
|
return substring;
|
|
}).join("").match(formattingTokensRegExp2);
|
|
const usedTokens = [];
|
|
for (let token of tokens) {
|
|
if (!(options == null ? void 0 : options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token)) {
|
|
warnOrThrowProtectedError(token, formatStr, dateStr);
|
|
}
|
|
if (!(options == null ? void 0 : options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {
|
|
warnOrThrowProtectedError(token, formatStr, dateStr);
|
|
}
|
|
const firstCharacter = token[0];
|
|
const parser = parsers[firstCharacter];
|
|
if (parser) {
|
|
const { incompatibleTokens } = parser;
|
|
if (Array.isArray(incompatibleTokens)) {
|
|
const incompatibleToken = usedTokens.find(
|
|
(usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter
|
|
);
|
|
if (incompatibleToken) {
|
|
throw new RangeError(
|
|
`The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time`
|
|
);
|
|
}
|
|
} else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) {
|
|
throw new RangeError(
|
|
`The format string mustn't contain \`${token}\` and any other token at the same time`
|
|
);
|
|
}
|
|
usedTokens.push({ token: firstCharacter, fullToken: token });
|
|
const parseResult = parser.run(
|
|
dateStr,
|
|
token,
|
|
locale.match,
|
|
subFnOptions
|
|
);
|
|
if (!parseResult) {
|
|
return constructFrom(referenceDate, NaN);
|
|
}
|
|
setters.push(parseResult.setter);
|
|
dateStr = parseResult.rest;
|
|
} else {
|
|
if (firstCharacter.match(unescapedLatinCharacterRegExp2)) {
|
|
throw new RangeError(
|
|
"Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
|
|
);
|
|
}
|
|
if (token === "''") {
|
|
token = "'";
|
|
} else if (firstCharacter === "'") {
|
|
token = cleanEscapedString2(token);
|
|
}
|
|
if (dateStr.indexOf(token) === 0) {
|
|
dateStr = dateStr.slice(token.length);
|
|
} else {
|
|
return constructFrom(referenceDate, NaN);
|
|
}
|
|
}
|
|
}
|
|
if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) {
|
|
return constructFrom(referenceDate, NaN);
|
|
}
|
|
const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a, b) => b - a).filter((priority, index, array) => array.indexOf(priority) === index).map(
|
|
(priority) => setters.filter((setter) => setter.priority === priority).sort((a, b) => b.subPriority - a.subPriority)
|
|
).map((setterArray) => setterArray[0]);
|
|
let date = toDate(referenceDate);
|
|
if (isNaN(date.getTime())) {
|
|
return constructFrom(referenceDate, NaN);
|
|
}
|
|
const flags = {};
|
|
for (const setter of uniquePrioritySetters) {
|
|
if (!setter.validate(date, subFnOptions)) {
|
|
return constructFrom(referenceDate, NaN);
|
|
}
|
|
const result = setter.set(date, flags, subFnOptions);
|
|
if (Array.isArray(result)) {
|
|
date = result[0];
|
|
Object.assign(flags, result[1]);
|
|
} else {
|
|
date = result;
|
|
}
|
|
}
|
|
return constructFrom(referenceDate, date);
|
|
}
|
|
function cleanEscapedString2(input) {
|
|
return input.match(escapedStringRegExp2)[1].replace(doubleQuoteRegExp2, "'");
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isMatch.mjs
|
|
function isMatch(dateStr, formatStr, options) {
|
|
return isValid(parse(dateStr, formatStr, /* @__PURE__ */ new Date(), options));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isMonday.mjs
|
|
function isMonday(date) {
|
|
return toDate(date).getDay() === 1;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isPast.mjs
|
|
function isPast(date) {
|
|
return +toDate(date) < Date.now();
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfHour.mjs
|
|
function startOfHour(date) {
|
|
const _date = toDate(date);
|
|
_date.setMinutes(0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSameHour.mjs
|
|
function isSameHour(dateLeft, dateRight) {
|
|
const dateLeftStartOfHour = startOfHour(dateLeft);
|
|
const dateRightStartOfHour = startOfHour(dateRight);
|
|
return +dateLeftStartOfHour === +dateRightStartOfHour;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSameWeek.mjs
|
|
function isSameWeek(dateLeft, dateRight, options) {
|
|
const dateLeftStartOfWeek = startOfWeek(dateLeft, options);
|
|
const dateRightStartOfWeek = startOfWeek(dateRight, options);
|
|
return +dateLeftStartOfWeek === +dateRightStartOfWeek;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSameISOWeek.mjs
|
|
function isSameISOWeek(dateLeft, dateRight) {
|
|
return isSameWeek(dateLeft, dateRight, { weekStartsOn: 1 });
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSameISOWeekYear.mjs
|
|
function isSameISOWeekYear(dateLeft, dateRight) {
|
|
const dateLeftStartOfYear = startOfISOWeekYear(dateLeft);
|
|
const dateRightStartOfYear = startOfISOWeekYear(dateRight);
|
|
return +dateLeftStartOfYear === +dateRightStartOfYear;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSameMinute.mjs
|
|
function isSameMinute(dateLeft, dateRight) {
|
|
const dateLeftStartOfMinute = startOfMinute(dateLeft);
|
|
const dateRightStartOfMinute = startOfMinute(dateRight);
|
|
return +dateLeftStartOfMinute === +dateRightStartOfMinute;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSameMonth.mjs
|
|
function isSameMonth(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
return _dateLeft.getFullYear() === _dateRight.getFullYear() && _dateLeft.getMonth() === _dateRight.getMonth();
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSameQuarter.mjs
|
|
function isSameQuarter(dateLeft, dateRight) {
|
|
const dateLeftStartOfQuarter = startOfQuarter(dateLeft);
|
|
const dateRightStartOfQuarter = startOfQuarter(dateRight);
|
|
return +dateLeftStartOfQuarter === +dateRightStartOfQuarter;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfSecond.mjs
|
|
function startOfSecond(date) {
|
|
const _date = toDate(date);
|
|
_date.setMilliseconds(0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSameSecond.mjs
|
|
function isSameSecond(dateLeft, dateRight) {
|
|
const dateLeftStartOfSecond = startOfSecond(dateLeft);
|
|
const dateRightStartOfSecond = startOfSecond(dateRight);
|
|
return +dateLeftStartOfSecond === +dateRightStartOfSecond;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isSameYear.mjs
|
|
function isSameYear(dateLeft, dateRight) {
|
|
const _dateLeft = toDate(dateLeft);
|
|
const _dateRight = toDate(dateRight);
|
|
return _dateLeft.getFullYear() === _dateRight.getFullYear();
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isThisHour.mjs
|
|
function isThisHour(date) {
|
|
return isSameHour(date, constructNow(date));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isThisISOWeek.mjs
|
|
function isThisISOWeek(date) {
|
|
return isSameISOWeek(date, constructNow(date));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isThisMinute.mjs
|
|
function isThisMinute(date) {
|
|
return isSameMinute(date, constructNow(date));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isThisMonth.mjs
|
|
function isThisMonth(date) {
|
|
return isSameMonth(date, constructNow(date));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isThisQuarter.mjs
|
|
function isThisQuarter(date) {
|
|
return isSameQuarter(date, constructNow(date));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isThisSecond.mjs
|
|
function isThisSecond(date) {
|
|
return isSameSecond(date, constructNow(date));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isThisWeek.mjs
|
|
function isThisWeek(date, options) {
|
|
return isSameWeek(date, constructNow(date), options);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isThisYear.mjs
|
|
function isThisYear(date) {
|
|
return isSameYear(date, constructNow(date));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isThursday.mjs
|
|
function isThursday(date) {
|
|
return toDate(date).getDay() === 4;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isToday.mjs
|
|
function isToday(date) {
|
|
return isSameDay(date, constructNow(date));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isTomorrow.mjs
|
|
function isTomorrow(date) {
|
|
return isSameDay(date, addDays(constructNow(date), 1));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isTuesday.mjs
|
|
function isTuesday(date) {
|
|
return toDate(date).getDay() === 2;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isWednesday.mjs
|
|
function isWednesday(date) {
|
|
return toDate(date).getDay() === 3;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isWithinInterval.mjs
|
|
function isWithinInterval(date, interval2) {
|
|
const time = +toDate(date);
|
|
const [startTime, endTime] = [
|
|
+toDate(interval2.start),
|
|
+toDate(interval2.end)
|
|
].sort((a, b) => a - b);
|
|
return time >= startTime && time <= endTime;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subDays.mjs
|
|
function subDays(date, amount) {
|
|
return addDays(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/isYesterday.mjs
|
|
function isYesterday(date) {
|
|
return isSameDay(date, subDays(constructNow(date), 1));
|
|
}
|
|
|
|
// ../../node_modules/date-fns/lastDayOfDecade.mjs
|
|
function lastDayOfDecade(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
const decade = 9 + Math.floor(year / 10) * 10;
|
|
_date.setFullYear(decade + 1, 0, 0);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/lastDayOfWeek.mjs
|
|
function lastDayOfWeek(date, options) {
|
|
var _a, _b, _c, _d;
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
|
|
const _date = toDate(date);
|
|
const day = _date.getDay();
|
|
const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
|
|
_date.setHours(0, 0, 0, 0);
|
|
_date.setDate(_date.getDate() + diff);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/lastDayOfISOWeek.mjs
|
|
function lastDayOfISOWeek(date) {
|
|
return lastDayOfWeek(date, { weekStartsOn: 1 });
|
|
}
|
|
|
|
// ../../node_modules/date-fns/lastDayOfISOWeekYear.mjs
|
|
function lastDayOfISOWeekYear(date) {
|
|
const year = getISOWeekYear(date);
|
|
const fourthOfJanuary = constructFrom(date, 0);
|
|
fourthOfJanuary.setFullYear(year + 1, 0, 4);
|
|
fourthOfJanuary.setHours(0, 0, 0, 0);
|
|
const _date = startOfISOWeek(fourthOfJanuary);
|
|
_date.setDate(_date.getDate() - 1);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/lastDayOfQuarter.mjs
|
|
function lastDayOfQuarter(date) {
|
|
const _date = toDate(date);
|
|
const currentMonth = _date.getMonth();
|
|
const month = currentMonth - currentMonth % 3 + 3;
|
|
_date.setMonth(month, 0);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/lastDayOfYear.mjs
|
|
function lastDayOfYear(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
_date.setFullYear(year + 1, 0, 0);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/lightFormat.mjs
|
|
var formattingTokensRegExp3 = /(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
var escapedStringRegExp3 = /^'([^]*?)'?$/;
|
|
var doubleQuoteRegExp3 = /''/g;
|
|
var unescapedLatinCharacterRegExp3 = /[a-zA-Z]/;
|
|
function lightFormat(date, formatStr) {
|
|
const _date = toDate(date);
|
|
if (!isValid(_date)) {
|
|
throw new RangeError("Invalid time value");
|
|
}
|
|
const tokens = formatStr.match(formattingTokensRegExp3);
|
|
if (!tokens) return "";
|
|
const result = tokens.map((substring) => {
|
|
if (substring === "''") {
|
|
return "'";
|
|
}
|
|
const firstCharacter = substring[0];
|
|
if (firstCharacter === "'") {
|
|
return cleanEscapedString3(substring);
|
|
}
|
|
const formatter = lightFormatters[firstCharacter];
|
|
if (formatter) {
|
|
return formatter(_date, substring);
|
|
}
|
|
if (firstCharacter.match(unescapedLatinCharacterRegExp3)) {
|
|
throw new RangeError(
|
|
"Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
|
|
);
|
|
}
|
|
return substring;
|
|
}).join("");
|
|
return result;
|
|
}
|
|
function cleanEscapedString3(input) {
|
|
const matches = input.match(escapedStringRegExp3);
|
|
if (!matches) {
|
|
return input;
|
|
}
|
|
return matches[1].replace(doubleQuoteRegExp3, "'");
|
|
}
|
|
|
|
// ../../node_modules/date-fns/milliseconds.mjs
|
|
function milliseconds({
|
|
years,
|
|
months: months2,
|
|
weeks,
|
|
days: days2,
|
|
hours,
|
|
minutes,
|
|
seconds
|
|
}) {
|
|
let totalDays = 0;
|
|
if (years) totalDays += years * daysInYear;
|
|
if (months2) totalDays += months2 * (daysInYear / 12);
|
|
if (weeks) totalDays += weeks * 7;
|
|
if (days2) totalDays += days2;
|
|
let totalSeconds = totalDays * 24 * 60 * 60;
|
|
if (hours) totalSeconds += hours * 60 * 60;
|
|
if (minutes) totalSeconds += minutes * 60;
|
|
if (seconds) totalSeconds += seconds;
|
|
return Math.trunc(totalSeconds * 1e3);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/millisecondsToHours.mjs
|
|
function millisecondsToHours(milliseconds2) {
|
|
const hours = milliseconds2 / millisecondsInHour;
|
|
return Math.trunc(hours);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/millisecondsToMinutes.mjs
|
|
function millisecondsToMinutes(milliseconds2) {
|
|
const minutes = milliseconds2 / millisecondsInMinute;
|
|
return Math.trunc(minutes);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/millisecondsToSeconds.mjs
|
|
function millisecondsToSeconds(milliseconds2) {
|
|
const seconds = milliseconds2 / millisecondsInSecond;
|
|
return Math.trunc(seconds);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/minutesToHours.mjs
|
|
function minutesToHours(minutes) {
|
|
const hours = minutes / minutesInHour;
|
|
return Math.trunc(hours);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/minutesToMilliseconds.mjs
|
|
function minutesToMilliseconds(minutes) {
|
|
return Math.trunc(minutes * millisecondsInMinute);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/minutesToSeconds.mjs
|
|
function minutesToSeconds(minutes) {
|
|
return Math.trunc(minutes * secondsInMinute);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/monthsToQuarters.mjs
|
|
function monthsToQuarters(months2) {
|
|
const quarters = months2 / monthsInQuarter;
|
|
return Math.trunc(quarters);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/monthsToYears.mjs
|
|
function monthsToYears(months2) {
|
|
const years = months2 / monthsInYear;
|
|
return Math.trunc(years);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/nextDay.mjs
|
|
function nextDay(date, day) {
|
|
let delta = day - getDay(date);
|
|
if (delta <= 0) delta += 7;
|
|
return addDays(date, delta);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/nextFriday.mjs
|
|
function nextFriday(date) {
|
|
return nextDay(date, 5);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/nextMonday.mjs
|
|
function nextMonday(date) {
|
|
return nextDay(date, 1);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/nextSaturday.mjs
|
|
function nextSaturday(date) {
|
|
return nextDay(date, 6);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/nextSunday.mjs
|
|
function nextSunday(date) {
|
|
return nextDay(date, 0);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/nextThursday.mjs
|
|
function nextThursday(date) {
|
|
return nextDay(date, 4);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/nextTuesday.mjs
|
|
function nextTuesday(date) {
|
|
return nextDay(date, 2);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/nextWednesday.mjs
|
|
function nextWednesday(date) {
|
|
return nextDay(date, 3);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/parseISO.mjs
|
|
function parseISO(argument, options) {
|
|
const additionalDigits = (options == null ? void 0 : options.additionalDigits) ?? 2;
|
|
const dateStrings = splitDateString(argument);
|
|
let date;
|
|
if (dateStrings.date) {
|
|
const parseYearResult = parseYear(dateStrings.date, additionalDigits);
|
|
date = parseDate(parseYearResult.restDateString, parseYearResult.year);
|
|
}
|
|
if (!date || isNaN(date.getTime())) {
|
|
return /* @__PURE__ */ new Date(NaN);
|
|
}
|
|
const timestamp = date.getTime();
|
|
let time = 0;
|
|
let offset;
|
|
if (dateStrings.time) {
|
|
time = parseTime(dateStrings.time);
|
|
if (isNaN(time)) {
|
|
return /* @__PURE__ */ new Date(NaN);
|
|
}
|
|
}
|
|
if (dateStrings.timezone) {
|
|
offset = parseTimezone(dateStrings.timezone);
|
|
if (isNaN(offset)) {
|
|
return /* @__PURE__ */ new Date(NaN);
|
|
}
|
|
} else {
|
|
const dirtyDate = new Date(timestamp + time);
|
|
const result = /* @__PURE__ */ new Date(0);
|
|
result.setFullYear(
|
|
dirtyDate.getUTCFullYear(),
|
|
dirtyDate.getUTCMonth(),
|
|
dirtyDate.getUTCDate()
|
|
);
|
|
result.setHours(
|
|
dirtyDate.getUTCHours(),
|
|
dirtyDate.getUTCMinutes(),
|
|
dirtyDate.getUTCSeconds(),
|
|
dirtyDate.getUTCMilliseconds()
|
|
);
|
|
return result;
|
|
}
|
|
return new Date(timestamp + time + offset);
|
|
}
|
|
var patterns = {
|
|
dateTimeDelimiter: /[T ]/,
|
|
timeZoneDelimiter: /[Z ]/i,
|
|
timezone: /([Z+-].*)$/
|
|
};
|
|
var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
|
|
var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
|
|
var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
function splitDateString(dateString) {
|
|
const dateStrings = {};
|
|
const array = dateString.split(patterns.dateTimeDelimiter);
|
|
let timeString;
|
|
if (array.length > 2) {
|
|
return dateStrings;
|
|
}
|
|
if (/:/.test(array[0])) {
|
|
timeString = array[0];
|
|
} else {
|
|
dateStrings.date = array[0];
|
|
timeString = array[1];
|
|
if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
|
|
dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
|
|
timeString = dateString.substr(
|
|
dateStrings.date.length,
|
|
dateString.length
|
|
);
|
|
}
|
|
}
|
|
if (timeString) {
|
|
const token = patterns.timezone.exec(timeString);
|
|
if (token) {
|
|
dateStrings.time = timeString.replace(token[1], "");
|
|
dateStrings.timezone = token[1];
|
|
} else {
|
|
dateStrings.time = timeString;
|
|
}
|
|
}
|
|
return dateStrings;
|
|
}
|
|
function parseYear(dateString, additionalDigits) {
|
|
const regex = new RegExp(
|
|
"^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
|
|
);
|
|
const captures = dateString.match(regex);
|
|
if (!captures) return { year: NaN, restDateString: "" };
|
|
const year = captures[1] ? parseInt(captures[1]) : null;
|
|
const century = captures[2] ? parseInt(captures[2]) : null;
|
|
return {
|
|
year: century === null ? year : century * 100,
|
|
restDateString: dateString.slice((captures[1] || captures[2]).length)
|
|
};
|
|
}
|
|
function parseDate(dateString, year) {
|
|
if (year === null) return /* @__PURE__ */ new Date(NaN);
|
|
const captures = dateString.match(dateRegex);
|
|
if (!captures) return /* @__PURE__ */ new Date(NaN);
|
|
const isWeekDate = !!captures[4];
|
|
const dayOfYear = parseDateUnit(captures[1]);
|
|
const month = parseDateUnit(captures[2]) - 1;
|
|
const day = parseDateUnit(captures[3]);
|
|
const week = parseDateUnit(captures[4]);
|
|
const dayOfWeek = parseDateUnit(captures[5]) - 1;
|
|
if (isWeekDate) {
|
|
if (!validateWeekDate(year, week, dayOfWeek)) {
|
|
return /* @__PURE__ */ new Date(NaN);
|
|
}
|
|
return dayOfISOWeekYear(year, week, dayOfWeek);
|
|
} else {
|
|
const date = /* @__PURE__ */ new Date(0);
|
|
if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
|
|
return /* @__PURE__ */ new Date(NaN);
|
|
}
|
|
date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
|
|
return date;
|
|
}
|
|
}
|
|
function parseDateUnit(value) {
|
|
return value ? parseInt(value) : 1;
|
|
}
|
|
function parseTime(timeString) {
|
|
const captures = timeString.match(timeRegex);
|
|
if (!captures) return NaN;
|
|
const hours = parseTimeUnit(captures[1]);
|
|
const minutes = parseTimeUnit(captures[2]);
|
|
const seconds = parseTimeUnit(captures[3]);
|
|
if (!validateTime(hours, minutes, seconds)) {
|
|
return NaN;
|
|
}
|
|
return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
|
|
}
|
|
function parseTimeUnit(value) {
|
|
return value && parseFloat(value.replace(",", ".")) || 0;
|
|
}
|
|
function parseTimezone(timezoneString) {
|
|
if (timezoneString === "Z") return 0;
|
|
const captures = timezoneString.match(timezoneRegex);
|
|
if (!captures) return 0;
|
|
const sign = captures[1] === "+" ? -1 : 1;
|
|
const hours = parseInt(captures[2]);
|
|
const minutes = captures[3] && parseInt(captures[3]) || 0;
|
|
if (!validateTimezone(hours, minutes)) {
|
|
return NaN;
|
|
}
|
|
return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
|
|
}
|
|
function dayOfISOWeekYear(isoWeekYear, week, day) {
|
|
const date = /* @__PURE__ */ new Date(0);
|
|
date.setUTCFullYear(isoWeekYear, 0, 4);
|
|
const fourthOfJanuaryDay = date.getUTCDay() || 7;
|
|
const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
|
|
date.setUTCDate(date.getUTCDate() + diff);
|
|
return date;
|
|
}
|
|
var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
function isLeapYearIndex2(year) {
|
|
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
|
}
|
|
function validateDate(year, month, date) {
|
|
return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex2(year) ? 29 : 28));
|
|
}
|
|
function validateDayOfYearDate(year, dayOfYear) {
|
|
return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex2(year) ? 366 : 365);
|
|
}
|
|
function validateWeekDate(_year, week, day) {
|
|
return week >= 1 && week <= 53 && day >= 0 && day <= 6;
|
|
}
|
|
function validateTime(hours, minutes, seconds) {
|
|
if (hours === 24) {
|
|
return minutes === 0 && seconds === 0;
|
|
}
|
|
return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
|
|
}
|
|
function validateTimezone(_hours, minutes) {
|
|
return minutes >= 0 && minutes <= 59;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/parseJSON.mjs
|
|
function parseJSON(dateStr) {
|
|
const parts = dateStr.match(
|
|
/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/
|
|
);
|
|
if (parts) {
|
|
return new Date(
|
|
Date.UTC(
|
|
+parts[1],
|
|
+parts[2] - 1,
|
|
+parts[3],
|
|
+parts[4] - (+parts[9] || 0) * (parts[8] == "-" ? -1 : 1),
|
|
+parts[5] - (+parts[10] || 0) * (parts[8] == "-" ? -1 : 1),
|
|
+parts[6],
|
|
+((parts[7] || "0") + "00").substring(0, 3)
|
|
)
|
|
);
|
|
}
|
|
return /* @__PURE__ */ new Date(NaN);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/previousDay.mjs
|
|
function previousDay(date, day) {
|
|
let delta = getDay(date) - day;
|
|
if (delta <= 0) delta += 7;
|
|
return subDays(date, delta);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/previousFriday.mjs
|
|
function previousFriday(date) {
|
|
return previousDay(date, 5);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/previousMonday.mjs
|
|
function previousMonday(date) {
|
|
return previousDay(date, 1);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/previousSaturday.mjs
|
|
function previousSaturday(date) {
|
|
return previousDay(date, 6);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/previousSunday.mjs
|
|
function previousSunday(date) {
|
|
return previousDay(date, 0);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/previousThursday.mjs
|
|
function previousThursday(date) {
|
|
return previousDay(date, 4);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/previousTuesday.mjs
|
|
function previousTuesday(date) {
|
|
return previousDay(date, 2);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/previousWednesday.mjs
|
|
function previousWednesday(date) {
|
|
return previousDay(date, 3);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/quartersToMonths.mjs
|
|
function quartersToMonths(quarters) {
|
|
return Math.trunc(quarters * monthsInQuarter);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/quartersToYears.mjs
|
|
function quartersToYears(quarters) {
|
|
const years = quarters / quartersInYear;
|
|
return Math.trunc(years);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/roundToNearestHours.mjs
|
|
function roundToNearestHours(date, options) {
|
|
const nearestTo = (options == null ? void 0 : options.nearestTo) ?? 1;
|
|
if (nearestTo < 1 || nearestTo > 12) return constructFrom(date, NaN);
|
|
const _date = toDate(date);
|
|
const fractionalMinutes = _date.getMinutes() / 60;
|
|
const fractionalSeconds = _date.getSeconds() / 60 / 60;
|
|
const fractionalMilliseconds = _date.getMilliseconds() / 1e3 / 60 / 60;
|
|
const hours = _date.getHours() + fractionalMinutes + fractionalSeconds + fractionalMilliseconds;
|
|
const method = (options == null ? void 0 : options.roundingMethod) ?? "round";
|
|
const roundingMethod = getRoundingMethod(method);
|
|
const roundedHours = roundingMethod(hours / nearestTo) * nearestTo;
|
|
const result = constructFrom(date, _date);
|
|
result.setHours(roundedHours, 0, 0, 0);
|
|
return result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/roundToNearestMinutes.mjs
|
|
function roundToNearestMinutes(date, options) {
|
|
const nearestTo = (options == null ? void 0 : options.nearestTo) ?? 1;
|
|
if (nearestTo < 1 || nearestTo > 30) return constructFrom(date, NaN);
|
|
const _date = toDate(date);
|
|
const fractionalSeconds = _date.getSeconds() / 60;
|
|
const fractionalMilliseconds = _date.getMilliseconds() / 1e3 / 60;
|
|
const minutes = _date.getMinutes() + fractionalSeconds + fractionalMilliseconds;
|
|
const method = (options == null ? void 0 : options.roundingMethod) ?? "round";
|
|
const roundingMethod = getRoundingMethod(method);
|
|
const roundedMinutes = roundingMethod(minutes / nearestTo) * nearestTo;
|
|
const result = constructFrom(date, _date);
|
|
result.setMinutes(roundedMinutes, 0, 0);
|
|
return result;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/secondsToHours.mjs
|
|
function secondsToHours(seconds) {
|
|
const hours = seconds / secondsInHour;
|
|
return Math.trunc(hours);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/secondsToMilliseconds.mjs
|
|
function secondsToMilliseconds(seconds) {
|
|
return seconds * millisecondsInSecond;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/secondsToMinutes.mjs
|
|
function secondsToMinutes(seconds) {
|
|
const minutes = seconds / secondsInMinute;
|
|
return Math.trunc(minutes);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setMonth.mjs
|
|
function setMonth(date, month) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
const day = _date.getDate();
|
|
const dateWithDesiredMonth = constructFrom(date, 0);
|
|
dateWithDesiredMonth.setFullYear(year, month, 15);
|
|
dateWithDesiredMonth.setHours(0, 0, 0, 0);
|
|
const daysInMonth = getDaysInMonth(dateWithDesiredMonth);
|
|
_date.setMonth(month, Math.min(day, daysInMonth));
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/set.mjs
|
|
function set(date, values) {
|
|
let _date = toDate(date);
|
|
if (isNaN(+_date)) {
|
|
return constructFrom(date, NaN);
|
|
}
|
|
if (values.year != null) {
|
|
_date.setFullYear(values.year);
|
|
}
|
|
if (values.month != null) {
|
|
_date = setMonth(_date, values.month);
|
|
}
|
|
if (values.date != null) {
|
|
_date.setDate(values.date);
|
|
}
|
|
if (values.hours != null) {
|
|
_date.setHours(values.hours);
|
|
}
|
|
if (values.minutes != null) {
|
|
_date.setMinutes(values.minutes);
|
|
}
|
|
if (values.seconds != null) {
|
|
_date.setSeconds(values.seconds);
|
|
}
|
|
if (values.milliseconds != null) {
|
|
_date.setMilliseconds(values.milliseconds);
|
|
}
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setDate.mjs
|
|
function setDate(date, dayOfMonth) {
|
|
const _date = toDate(date);
|
|
_date.setDate(dayOfMonth);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setDayOfYear.mjs
|
|
function setDayOfYear(date, dayOfYear) {
|
|
const _date = toDate(date);
|
|
_date.setMonth(0);
|
|
_date.setDate(dayOfYear);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setDefaultOptions.mjs
|
|
function setDefaultOptions2(options) {
|
|
const result = {};
|
|
const defaultOptions2 = getDefaultOptions();
|
|
for (const property in defaultOptions2) {
|
|
if (Object.prototype.hasOwnProperty.call(defaultOptions2, property)) {
|
|
result[property] = defaultOptions2[property];
|
|
}
|
|
}
|
|
for (const property in options) {
|
|
if (Object.prototype.hasOwnProperty.call(options, property)) {
|
|
if (options[property] === void 0) {
|
|
delete result[property];
|
|
} else {
|
|
result[property] = options[property];
|
|
}
|
|
}
|
|
}
|
|
setDefaultOptions(result);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setHours.mjs
|
|
function setHours(date, hours) {
|
|
const _date = toDate(date);
|
|
_date.setHours(hours);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setMilliseconds.mjs
|
|
function setMilliseconds(date, milliseconds2) {
|
|
const _date = toDate(date);
|
|
_date.setMilliseconds(milliseconds2);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setMinutes.mjs
|
|
function setMinutes(date, minutes) {
|
|
const _date = toDate(date);
|
|
_date.setMinutes(minutes);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setQuarter.mjs
|
|
function setQuarter(date, quarter) {
|
|
const _date = toDate(date);
|
|
const oldQuarter = Math.trunc(_date.getMonth() / 3) + 1;
|
|
const diff = quarter - oldQuarter;
|
|
return setMonth(_date, _date.getMonth() + diff * 3);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setSeconds.mjs
|
|
function setSeconds(date, seconds) {
|
|
const _date = toDate(date);
|
|
_date.setSeconds(seconds);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setWeekYear.mjs
|
|
function setWeekYear(date, weekYear, options) {
|
|
var _a, _b, _c, _d;
|
|
const defaultOptions2 = getDefaultOptions();
|
|
const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
|
|
let _date = toDate(date);
|
|
const diff = differenceInCalendarDays(_date, startOfWeekYear(_date, options));
|
|
const firstWeek = constructFrom(date, 0);
|
|
firstWeek.setFullYear(weekYear, 0, firstWeekContainsDate);
|
|
firstWeek.setHours(0, 0, 0, 0);
|
|
_date = startOfWeekYear(firstWeek, options);
|
|
_date.setDate(_date.getDate() + diff);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/setYear.mjs
|
|
function setYear(date, year) {
|
|
const _date = toDate(date);
|
|
if (isNaN(+_date)) {
|
|
return constructFrom(date, NaN);
|
|
}
|
|
_date.setFullYear(year);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfDecade.mjs
|
|
function startOfDecade(date) {
|
|
const _date = toDate(date);
|
|
const year = _date.getFullYear();
|
|
const decade = Math.floor(year / 10) * 10;
|
|
_date.setFullYear(decade, 0, 1);
|
|
_date.setHours(0, 0, 0, 0);
|
|
return _date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfToday.mjs
|
|
function startOfToday() {
|
|
return startOfDay(Date.now());
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfTomorrow.mjs
|
|
function startOfTomorrow() {
|
|
const now = /* @__PURE__ */ new Date();
|
|
const year = now.getFullYear();
|
|
const month = now.getMonth();
|
|
const day = now.getDate();
|
|
const date = /* @__PURE__ */ new Date(0);
|
|
date.setFullYear(year, month, day + 1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/startOfYesterday.mjs
|
|
function startOfYesterday() {
|
|
const now = /* @__PURE__ */ new Date();
|
|
const year = now.getFullYear();
|
|
const month = now.getMonth();
|
|
const day = now.getDate();
|
|
const date = /* @__PURE__ */ new Date(0);
|
|
date.setFullYear(year, month, day - 1);
|
|
date.setHours(0, 0, 0, 0);
|
|
return date;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subMonths.mjs
|
|
function subMonths(date, amount) {
|
|
return addMonths(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/sub.mjs
|
|
function sub(date, duration) {
|
|
const {
|
|
years = 0,
|
|
months: months2 = 0,
|
|
weeks = 0,
|
|
days: days2 = 0,
|
|
hours = 0,
|
|
minutes = 0,
|
|
seconds = 0
|
|
} = duration;
|
|
const dateWithoutMonths = subMonths(date, months2 + years * 12);
|
|
const dateWithoutDays = subDays(dateWithoutMonths, days2 + weeks * 7);
|
|
const minutestoSub = minutes + hours * 60;
|
|
const secondstoSub = seconds + minutestoSub * 60;
|
|
const mstoSub = secondstoSub * 1e3;
|
|
const finalDate = constructFrom(date, dateWithoutDays.getTime() - mstoSub);
|
|
return finalDate;
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subBusinessDays.mjs
|
|
function subBusinessDays(date, amount) {
|
|
return addBusinessDays(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subHours.mjs
|
|
function subHours(date, amount) {
|
|
return addHours(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subMilliseconds.mjs
|
|
function subMilliseconds(date, amount) {
|
|
return addMilliseconds(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subMinutes.mjs
|
|
function subMinutes(date, amount) {
|
|
return addMinutes(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subQuarters.mjs
|
|
function subQuarters(date, amount) {
|
|
return addQuarters(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subSeconds.mjs
|
|
function subSeconds(date, amount) {
|
|
return addSeconds(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subWeeks.mjs
|
|
function subWeeks(date, amount) {
|
|
return addWeeks(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/subYears.mjs
|
|
function subYears(date, amount) {
|
|
return addYears(date, -amount);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/weeksToDays.mjs
|
|
function weeksToDays(weeks) {
|
|
return Math.trunc(weeks * daysInWeek);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/yearsToDays.mjs
|
|
function yearsToDays(years) {
|
|
return Math.trunc(years * daysInYear);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/yearsToMonths.mjs
|
|
function yearsToMonths(years) {
|
|
return Math.trunc(years * monthsInYear);
|
|
}
|
|
|
|
// ../../node_modules/date-fns/yearsToQuarters.mjs
|
|
function yearsToQuarters(years) {
|
|
return Math.trunc(years * quartersInYear);
|
|
}
|
|
export {
|
|
add,
|
|
addBusinessDays,
|
|
addDays,
|
|
addHours,
|
|
addISOWeekYears,
|
|
addMilliseconds,
|
|
addMinutes,
|
|
addMonths,
|
|
addQuarters,
|
|
addSeconds,
|
|
addWeeks,
|
|
addYears,
|
|
areIntervalsOverlapping,
|
|
clamp,
|
|
closestIndexTo,
|
|
closestTo,
|
|
compareAsc,
|
|
compareDesc,
|
|
constructFrom,
|
|
constructNow,
|
|
daysToWeeks,
|
|
differenceInBusinessDays,
|
|
differenceInCalendarDays,
|
|
differenceInCalendarISOWeekYears,
|
|
differenceInCalendarISOWeeks,
|
|
differenceInCalendarMonths,
|
|
differenceInCalendarQuarters,
|
|
differenceInCalendarWeeks,
|
|
differenceInCalendarYears,
|
|
differenceInDays,
|
|
differenceInHours,
|
|
differenceInISOWeekYears,
|
|
differenceInMilliseconds,
|
|
differenceInMinutes,
|
|
differenceInMonths,
|
|
differenceInQuarters,
|
|
differenceInSeconds,
|
|
differenceInWeeks,
|
|
differenceInYears,
|
|
eachDayOfInterval,
|
|
eachHourOfInterval,
|
|
eachMinuteOfInterval,
|
|
eachMonthOfInterval,
|
|
eachQuarterOfInterval,
|
|
eachWeekOfInterval,
|
|
eachWeekendOfInterval,
|
|
eachWeekendOfMonth,
|
|
eachWeekendOfYear,
|
|
eachYearOfInterval,
|
|
endOfDay,
|
|
endOfDecade,
|
|
endOfHour,
|
|
endOfISOWeek,
|
|
endOfISOWeekYear,
|
|
endOfMinute,
|
|
endOfMonth,
|
|
endOfQuarter,
|
|
endOfSecond,
|
|
endOfToday,
|
|
endOfTomorrow,
|
|
endOfWeek,
|
|
endOfYear,
|
|
endOfYesterday,
|
|
format,
|
|
format as formatDate,
|
|
formatDistance2 as formatDistance,
|
|
formatDistanceStrict,
|
|
formatDistanceToNow,
|
|
formatDistanceToNowStrict,
|
|
formatDuration,
|
|
formatISO,
|
|
formatISO9075,
|
|
formatISODuration,
|
|
formatRFC3339,
|
|
formatRFC7231,
|
|
formatRelative2 as formatRelative,
|
|
formatters,
|
|
fromUnixTime,
|
|
getDate,
|
|
getDay,
|
|
getDayOfYear,
|
|
getDaysInMonth,
|
|
getDaysInYear,
|
|
getDecade,
|
|
getDefaultOptions2 as getDefaultOptions,
|
|
getHours,
|
|
getISODay,
|
|
getISOWeek,
|
|
getISOWeekYear,
|
|
getISOWeeksInYear,
|
|
getMilliseconds,
|
|
getMinutes,
|
|
getMonth,
|
|
getOverlappingDaysInIntervals,
|
|
getQuarter,
|
|
getSeconds,
|
|
getTime,
|
|
getUnixTime,
|
|
getWeek,
|
|
getWeekOfMonth,
|
|
getWeekYear,
|
|
getWeeksInMonth,
|
|
getYear,
|
|
hoursToMilliseconds,
|
|
hoursToMinutes,
|
|
hoursToSeconds,
|
|
interval,
|
|
intervalToDuration,
|
|
intlFormat,
|
|
intlFormatDistance,
|
|
isAfter,
|
|
isBefore,
|
|
isDate,
|
|
isEqual,
|
|
isExists,
|
|
isFirstDayOfMonth,
|
|
isFriday,
|
|
isFuture,
|
|
isLastDayOfMonth,
|
|
isLeapYear,
|
|
isMatch,
|
|
isMonday,
|
|
isPast,
|
|
isSameDay,
|
|
isSameHour,
|
|
isSameISOWeek,
|
|
isSameISOWeekYear,
|
|
isSameMinute,
|
|
isSameMonth,
|
|
isSameQuarter,
|
|
isSameSecond,
|
|
isSameWeek,
|
|
isSameYear,
|
|
isSaturday,
|
|
isSunday,
|
|
isThisHour,
|
|
isThisISOWeek,
|
|
isThisMinute,
|
|
isThisMonth,
|
|
isThisQuarter,
|
|
isThisSecond,
|
|
isThisWeek,
|
|
isThisYear,
|
|
isThursday,
|
|
isToday,
|
|
isTomorrow,
|
|
isTuesday,
|
|
isValid,
|
|
isWednesday,
|
|
isWeekend,
|
|
isWithinInterval,
|
|
isYesterday,
|
|
lastDayOfDecade,
|
|
lastDayOfISOWeek,
|
|
lastDayOfISOWeekYear,
|
|
lastDayOfMonth,
|
|
lastDayOfQuarter,
|
|
lastDayOfWeek,
|
|
lastDayOfYear,
|
|
lightFormat,
|
|
lightFormatters,
|
|
longFormatters,
|
|
max,
|
|
milliseconds,
|
|
millisecondsToHours,
|
|
millisecondsToMinutes,
|
|
millisecondsToSeconds,
|
|
min,
|
|
minutesToHours,
|
|
minutesToMilliseconds,
|
|
minutesToSeconds,
|
|
monthsToQuarters,
|
|
monthsToYears,
|
|
nextDay,
|
|
nextFriday,
|
|
nextMonday,
|
|
nextSaturday,
|
|
nextSunday,
|
|
nextThursday,
|
|
nextTuesday,
|
|
nextWednesday,
|
|
parse,
|
|
parseISO,
|
|
parseJSON,
|
|
parsers,
|
|
previousDay,
|
|
previousFriday,
|
|
previousMonday,
|
|
previousSaturday,
|
|
previousSunday,
|
|
previousThursday,
|
|
previousTuesday,
|
|
previousWednesday,
|
|
quartersToMonths,
|
|
quartersToYears,
|
|
roundToNearestHours,
|
|
roundToNearestMinutes,
|
|
secondsToHours,
|
|
secondsToMilliseconds,
|
|
secondsToMinutes,
|
|
set,
|
|
setDate,
|
|
setDay,
|
|
setDayOfYear,
|
|
setDefaultOptions2 as setDefaultOptions,
|
|
setHours,
|
|
setISODay,
|
|
setISOWeek,
|
|
setISOWeekYear,
|
|
setMilliseconds,
|
|
setMinutes,
|
|
setMonth,
|
|
setQuarter,
|
|
setSeconds,
|
|
setWeek,
|
|
setWeekYear,
|
|
setYear,
|
|
startOfDay,
|
|
startOfDecade,
|
|
startOfHour,
|
|
startOfISOWeek,
|
|
startOfISOWeekYear,
|
|
startOfMinute,
|
|
startOfMonth,
|
|
startOfQuarter,
|
|
startOfSecond,
|
|
startOfToday,
|
|
startOfTomorrow,
|
|
startOfWeek,
|
|
startOfWeekYear,
|
|
startOfYear,
|
|
startOfYesterday,
|
|
sub,
|
|
subBusinessDays,
|
|
subDays,
|
|
subHours,
|
|
subISOWeekYears,
|
|
subMilliseconds,
|
|
subMinutes,
|
|
subMonths,
|
|
subQuarters,
|
|
subSeconds,
|
|
subWeeks,
|
|
subYears,
|
|
toDate,
|
|
transpose,
|
|
weeksToDays,
|
|
yearsToDays,
|
|
yearsToMonths,
|
|
yearsToQuarters
|
|
};
|
|
//# sourceMappingURL=date-fns.js.map
|