date-fns
Version:
Modern JavaScript date utility library
1,739 lines (1,696 loc) • 260 kB
JavaScript
function ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {_defineProperty(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;}function _createForOfIteratorHelper(o, allowArrayLike) {var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];if (!it) {if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {if (it) o = it;var i = 0;var F = function F() {};return { s: F, n: function n() {if (i >= o.length) return { done: true };return { done: false, value: o[i++] };}, e: function e(_e) {throw _e;}, f: F };}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion = true,didErr = false,err;return { s: function s() {it = it.call(o);}, n: function n() {var step = it.next();normalCompletion = step.done;return step;}, e: function e(_e2) {didErr = true;err = _e2;}, f: function f() {try {if (!normalCompletion && it.return != null) it.return();} finally {if (didErr) throw err;}} };}function _callSuper(t, o, e) {return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e));}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;} else if (call !== void 0) {throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct() {try {var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));} catch (t) {}return (_isNativeReflectConstruct = function _isNativeReflectConstruct() {return !!t;})();}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });Object.defineProperty(subClass, "prototype", { writable: false });if (superClass) _setPrototypeOf(subClass, superClass);}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);}}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);Object.defineProperty(Constructor, "prototype", { writable: false });return Constructor;}function _defineProperty(obj, key, value) {key = _toPropertyKey(key);if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function _toPropertyKey(t) {var i = _toPrimitive(t, "string");return "symbol" == _typeof(i) ? i : String(i);}function _toPrimitive(t, r) {if ("object" != _typeof(t) || !t) return t;var e = t[Symbol.toPrimitive];if (void 0 !== e) {var i = e.call(t, r || "default");if ("object" != _typeof(i)) return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return ("string" === r ? String : Number)(t);}function _slicedToArray(arr, i) {return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();}function _nonIterableRest() {throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _iterableToArrayLimit(r, l) {var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];if (null != t) {var e,n,i,u,a = [],f = !0,o = !1;try {if (i = (t = t.call(r)).next, 0 === l) {if (Object(t) !== t) return;f = !1;} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);} catch (r) {o = !0, n = r;} finally {try {if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;} finally {if (o) throw n;}}return a;}}function _arrayWithHoles(arr) {if (Array.isArray(arr)) return arr;}function _toConsumableArray(arr) {return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();}function _nonIterableSpread() {throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o, minLen) {if (!o) return;if (typeof o === "string") return _arrayLikeToArray(o, minLen);var n = Object.prototype.toString.call(o).slice(8, -1);if (n === "Object" && o.constructor) n = o.constructor.name;if (n === "Map" || n === "Set") return Array.from(o);if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);}function _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr, len) {if (len == null || len > arr.length) len = arr.length;for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];return arr2;}function _typeof(o) {"@babel/helpers - typeof";return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;}, _typeof(o);}(function () {var __defProp = Object.defineProperty;
var __export = function __export(target, all) {
for (var name in all)
__defProp(target, name, {
get: all[name],
enumerable: true,
configurable: true,
set: function set(newValue) {return all[name] = function () {return newValue;};}
});
};
// lib/fp.mjs
var exports_fp = {};
__export(exports_fp, {
yearsToQuarters: function yearsToQuarters() {
{
return yearsToQuarters3;
}
},
yearsToMonths: function yearsToMonths() {
{
return yearsToMonths3;
}
},
yearsToDays: function yearsToDays() {
{
return yearsToDays3;
}
},
weeksToDays: function weeksToDays() {
{
return weeksToDays3;
}
},
transpose: function transpose() {
{
return transpose4;
}
},
toDate: function toDate() {
{
return toDate127;
}
},
subYears: function subYears() {
{
return subYears3;
}
},
subWeeks: function subWeeks() {
{
return subWeeks3;
}
},
subSeconds: function subSeconds() {
{
return subSeconds3;
}
},
subQuarters: function subQuarters() {
{
return subQuarters3;
}
},
subMonths: function subMonths() {
{
return subMonths4;
}
},
subMinutes: function subMinutes() {
{
return subMinutes3;
}
},
subMilliseconds: function subMilliseconds() {
{
return subMilliseconds3;
}
},
subISOWeekYears: function subISOWeekYears() {
{
return subISOWeekYears4;
}
},
subHours: function subHours() {
{
return subHours3;
}
},
subDays: function subDays() {
{
return subDays5;
}
},
subBusinessDays: function subBusinessDays() {
{
return subBusinessDays3;
}
},
sub: function sub() {
{
return sub3;
}
},
startOfYear: function startOfYear() {
{
return startOfYear5;
}
},
startOfWeekYearWithOptions: function startOfWeekYearWithOptions() {
{
return _startOfWeekYearWithOptions;
}
},
startOfWeekYear: function startOfWeekYear() {
{
return startOfWeekYear5;
}
},
startOfWeekWithOptions: function startOfWeekWithOptions() {
{
return _startOfWeekWithOptions;
}
},
startOfWeek: function startOfWeek() {
{
return startOfWeek12;
}
},
startOfSecond: function startOfSecond() {
{
return startOfSecond4;
}
},
startOfQuarter: function startOfQuarter() {
{
return startOfQuarter5;
}
},
startOfMonth: function startOfMonth() {
{
return startOfMonth6;
}
},
startOfMinute: function startOfMinute() {
{
return startOfMinute5;
}
},
startOfISOWeekYear: function startOfISOWeekYear() {
{
return startOfISOWeekYear7;
}
},
startOfISOWeek: function startOfISOWeek() {
{
return startOfISOWeek11;
}
},
startOfHour: function startOfHour() {
{
return startOfHour4;
}
},
startOfDecade: function startOfDecade() {
{
return startOfDecade3;
}
},
startOfDay: function startOfDay() {
{
return startOfDay5;
}
},
setYear: function setYear() {
{
return setYear3;
}
},
setWeekYearWithOptions: function setWeekYearWithOptions() {
{
return _setWeekYearWithOptions;
}
},
setWeekYear: function setWeekYear() {
{
return setWeekYear3;
}
},
setWeekWithOptions: function setWeekWithOptions() {
{
return _setWeekWithOptions;
}
},
setWeek: function setWeek() {
{
return setWeek4;
}
},
setSeconds: function setSeconds() {
{
return setSeconds3;
}
},
setQuarter: function setQuarter() {
{
return setQuarter3;
}
},
setMonth: function setMonth() {
{
return setMonth4;
}
},
setMinutes: function setMinutes() {
{
return setMinutes3;
}
},
setMilliseconds: function setMilliseconds() {
{
return setMilliseconds3;
}
},
setISOWeekYear: function setISOWeekYear() {
{
return setISOWeekYear4;
}
},
setISOWeek: function setISOWeek() {
{
return setISOWeek4;
}
},
setISODay: function setISODay() {
{
return setISODay4;
}
},
setHours: function setHours() {
{
return setHours3;
}
},
setDayWithOptions: function setDayWithOptions() {
{
return _setDayWithOptions;
}
},
setDayOfYear: function setDayOfYear() {
{
return setDayOfYear3;
}
},
setDay: function setDay() {
{
return setDay6;
}
},
setDate: function setDate() {
{
return setDate3;
}
},
set: function set() {
{
return set3;
}
},
secondsToMinutes: function secondsToMinutes() {
{
return secondsToMinutes3;
}
},
secondsToMilliseconds: function secondsToMilliseconds() {
{
return secondsToMilliseconds3;
}
},
secondsToHours: function secondsToHours() {
{
return secondsToHours3;
}
},
roundToNearestMinutesWithOptions: function roundToNearestMinutesWithOptions() {
{
return _roundToNearestMinutesWithOptions;
}
},
roundToNearestMinutes: function roundToNearestMinutes() {
{
return roundToNearestMinutes3;
}
},
roundToNearestHoursWithOptions: function roundToNearestHoursWithOptions() {
{
return _roundToNearestHoursWithOptions;
}
},
roundToNearestHours: function roundToNearestHours() {
{
return roundToNearestHours3;
}
},
quartersToYears: function quartersToYears() {
{
return quartersToYears3;
}
},
quartersToMonths: function quartersToMonths() {
{
return quartersToMonths3;
}
},
previousWednesday: function previousWednesday() {
{
return previousWednesday3;
}
},
previousTuesday: function previousTuesday() {
{
return previousTuesday3;
}
},
previousThursday: function previousThursday() {
{
return previousThursday3;
}
},
previousSunday: function previousSunday() {
{
return previousSunday3;
}
},
previousSaturday: function previousSaturday() {
{
return previousSaturday3;
}
},
previousMonday: function previousMonday() {
{
return previousMonday3;
}
},
previousFriday: function previousFriday() {
{
return previousFriday3;
}
},
previousDay: function previousDay() {
{
return previousDay3;
}
},
parseWithOptions: function parseWithOptions() {
{
return _parseWithOptions;
}
},
parseJSON: function parseJSON() {
{
return parseJSON3;
}
},
parseISOWithOptions: function parseISOWithOptions() {
{
return _parseISOWithOptions;
}
},
parseISO: function parseISO() {
{
return parseISO3;
}
},
parse: function parse() {
{
return parse4;
}
},
nextWednesday: function nextWednesday() {
{
return nextWednesday3;
}
},
nextTuesday: function nextTuesday() {
{
return nextTuesday3;
}
},
nextThursday: function nextThursday() {
{
return nextThursday3;
}
},
nextSunday: function nextSunday() {
{
return nextSunday3;
}
},
nextSaturday: function nextSaturday() {
{
return nextSaturday3;
}
},
nextMonday: function nextMonday() {
{
return nextMonday3;
}
},
nextFriday: function nextFriday() {
{
return nextFriday3;
}
},
nextDay: function nextDay() {
{
return nextDay3;
}
},
monthsToYears: function monthsToYears() {
{
return monthsToYears3;
}
},
monthsToQuarters: function monthsToQuarters() {
{
return monthsToQuarters3;
}
},
minutesToSeconds: function minutesToSeconds() {
{
return minutesToSeconds3;
}
},
minutesToMilliseconds: function minutesToMilliseconds() {
{
return minutesToMilliseconds3;
}
},
minutesToHours: function minutesToHours() {
{
return minutesToHours3;
}
},
min: function min() {
{
return min4;
}
},
millisecondsToSeconds: function millisecondsToSeconds() {
{
return millisecondsToSeconds3;
}
},
millisecondsToMinutes: function millisecondsToMinutes() {
{
return millisecondsToMinutes3;
}
},
millisecondsToHours: function millisecondsToHours() {
{
return millisecondsToHours3;
}
},
milliseconds: function milliseconds() {
{
return milliseconds3;
}
},
max: function max() {
{
return max4;
}
},
lightFormat: function lightFormat() {
{
return lightFormat3;
}
},
lastDayOfYear: function lastDayOfYear() {
{
return lastDayOfYear3;
}
},
lastDayOfWeekWithOptions: function lastDayOfWeekWithOptions() {
{
return _lastDayOfWeekWithOptions;
}
},
lastDayOfWeek: function lastDayOfWeek() {
{
return lastDayOfWeek4;
}
},
lastDayOfQuarter: function lastDayOfQuarter() {
{
return lastDayOfQuarter3;
}
},
lastDayOfMonth: function lastDayOfMonth() {
{
return lastDayOfMonth4;
}
},
lastDayOfISOWeekYear: function lastDayOfISOWeekYear() {
{
return lastDayOfISOWeekYear3;
}
},
lastDayOfISOWeek: function lastDayOfISOWeek() {
{
return lastDayOfISOWeek3;
}
},
lastDayOfDecade: function lastDayOfDecade() {
{
return lastDayOfDecade3;
}
},
isWithinInterval: function isWithinInterval() {
{
return isWithinInterval3;
}
},
isWeekend: function isWeekend() {
{
return isWeekend6;
}
},
isWednesday: function isWednesday() {
{
return isWednesday3;
}
},
isValid: function isValid() {
{
return isValid9;
}
},
isTuesday: function isTuesday() {
{
return isTuesday3;
}
},
isThursday: function isThursday() {
{
return isThursday3;
}
},
isSunday: function isSunday() {
{
return isSunday4;
}
},
isSaturday: function isSaturday() {
{
return isSaturday4;
}
},
isSameYear: function isSameYear() {
{
return isSameYear3;
}
},
isSameWeekWithOptions: function isSameWeekWithOptions() {
{
return _isSameWeekWithOptions;
}
},
isSameWeek: function isSameWeek() {
{
return isSameWeek4;
}
},
isSameSecond: function isSameSecond() {
{
return isSameSecond3;
}
},
isSameQuarter: function isSameQuarter() {
{
return isSameQuarter3;
}
},
isSameMonth: function isSameMonth() {
{
return isSameMonth3;
}
},
isSameMinute: function isSameMinute() {
{
return isSameMinute3;
}
},
isSameISOWeekYear: function isSameISOWeekYear() {
{
return isSameISOWeekYear3;
}
},
isSameISOWeek: function isSameISOWeek() {
{
return isSameISOWeek3;
}
},
isSameHour: function isSameHour() {
{
return isSameHour3;
}
},
isSameDay: function isSameDay() {
{
return isSameDay4;
}
},
isMonday: function isMonday() {
{
return isMonday3;
}
},
isMatchWithOptions: function isMatchWithOptions() {
{
return _isMatchWithOptions;
}
},
isMatch: function isMatch() {
{
return isMatch3;
}
},
isLeapYear: function isLeapYear() {
{
return isLeapYear4;
}
},
isLastDayOfMonth: function isLastDayOfMonth() {
{
return isLastDayOfMonth4;
}
},
isFriday: function isFriday() {
{
return isFriday3;
}
},
isFirstDayOfMonth: function isFirstDayOfMonth() {
{
return isFirstDayOfMonth3;
}
},
isExists: function isExists() {
{
return isExists3;
}
},
isEqual: function isEqual() {
{
return isEqual3;
}
},
isDate: function isDate() {
{
return isDate4;
}
},
isBefore: function isBefore() {
{
return isBefore3;
}
},
isAfter: function isAfter() {
{
return isAfter3;
}
},
intlFormatDistanceWithOptions: function intlFormatDistanceWithOptions() {
{
return _intlFormatDistanceWithOptions;
}
},
intlFormatDistance: function intlFormatDistance() {
{
return intlFormatDistance3;
}
},
intlFormat: function intlFormat() {
{
return intlFormat3;
}
},
intervalWithOptions: function intervalWithOptions() {
{
return _intervalWithOptions;
}
},
intervalToDuration: function intervalToDuration() {
{
return intervalToDuration3;
}
},
interval: function interval() {
{
return interval3;
}
},
hoursToSeconds: function hoursToSeconds() {
{
return hoursToSeconds3;
}
},
hoursToMinutes: function hoursToMinutes() {
{
return hoursToMinutes3;
}
},
hoursToMilliseconds: function hoursToMilliseconds() {
{
return hoursToMilliseconds3;
}
},
getYear: function getYear() {
{
return getYear3;
}
},
getWeeksInMonthWithOptions: function getWeeksInMonthWithOptions() {
{
return _getWeeksInMonthWithOptions;
}
},
getWeeksInMonth: function getWeeksInMonth() {
{
return getWeeksInMonth3;
}
},
getWeekYearWithOptions: function getWeekYearWithOptions() {
{
return _getWeekYearWithOptions;
}
},
getWeekYear: function getWeekYear() {
{
return getWeekYear5;
}
},
getWeekWithOptions: function getWeekWithOptions() {
{
return _getWeekWithOptions;
}
},
getWeekOfMonthWithOptions: function getWeekOfMonthWithOptions() {
{
return _getWeekOfMonthWithOptions;
}
},
getWeekOfMonth: function getWeekOfMonth() {
{
return getWeekOfMonth3;
}
},
getWeek: function getWeek() {
{
return getWeek4;
}
},
getUnixTime: function getUnixTime() {
{
return getUnixTime3;
}
},
getTime: function getTime() {
{
return getTime3;
}
},
getSeconds: function getSeconds() {
{
return getSeconds3;
}
},
getQuarter: function getQuarter() {
{
return getQuarter4;
}
},
getOverlappingDaysInIntervals: function getOverlappingDaysInIntervals() {
{
return getOverlappingDaysInIntervals3;
}
},
getMonth: function getMonth() {
{
return getMonth3;
}
},
getMinutes: function getMinutes() {
{
return getMinutes3;
}
},
getMilliseconds: function getMilliseconds() {
{
return getMilliseconds3;
}
},
getISOWeeksInYear: function getISOWeeksInYear() {
{
return getISOWeeksInYear3;
}
},
getISOWeekYear: function getISOWeekYear() {
{
return getISOWeekYear8;
}
},
getISOWeek: function getISOWeek() {
{
return getISOWeek4;
}
},
getISODay: function getISODay() {
{
return getISODay3;
}
},
getHours: function getHours() {
{
return getHours3;
}
},
getDecade: function getDecade() {
{
return getDecade3;
}
},
getDaysInYear: function getDaysInYear() {
{
return getDaysInYear3;
}
},
getDaysInMonth: function getDaysInMonth() {
{
return getDaysInMonth3;
}
},
getDayOfYear: function getDayOfYear() {
{
return getDayOfYear4;
}
},
getDay: function getDay() {
{
return getDay3;
}
},
getDate: function getDate() {
{
return getDate3;
}
},
fromUnixTime: function fromUnixTime() {
{
return fromUnixTime3;
}
},
formatWithOptions: function formatWithOptions() {
{
return _formatWithOptions;
}
},
formatRelativeWithOptions: function formatRelativeWithOptions() {
{
return _formatRelativeWithOptions;
}
},
formatRelative: function formatRelative() {
{
return formatRelative5;
}
},
formatRFC7231: function formatRFC7231() {
{
return formatRFC72313;
}
},
formatRFC3339WithOptions: function formatRFC3339WithOptions() {
{
return _formatRFC3339WithOptions;
}
},
formatRFC3339: function formatRFC3339() {
{
return formatRFC33393;
}
},
formatISOWithOptions: function formatISOWithOptions() {
{
return _formatISOWithOptions;
}
},
formatISODuration: function formatISODuration() {
{
return formatISODuration3;
}
},
formatISO9075WithOptions: function formatISO9075WithOptions() {
{
return _formatISO9075WithOptions;
}
},
formatISO9075: function formatISO9075() {
{
return formatISO90753;
}
},
formatISO: function formatISO() {
{
return formatISO3;
}
},
formatDurationWithOptions: function formatDurationWithOptions() {
{
return _formatDurationWithOptions;
}
},
formatDuration: function formatDuration() {
{
return formatDuration3;
}
},
formatDistanceWithOptions: function formatDistanceWithOptions() {
{
return _formatDistanceWithOptions;
}
},
formatDistanceStrictWithOptions: function formatDistanceStrictWithOptions() {
{
return _formatDistanceStrictWithOptions;
}
},
formatDistanceStrict: function formatDistanceStrict() {
{
return formatDistanceStrict3;
}
},
formatDistance: function formatDistance() {
{
return formatDistance5;
}
},
format: function format() {
{
return format3;
}
},
endOfYear: function endOfYear() {
{
return endOfYear4;
}
},
endOfWeekWithOptions: function endOfWeekWithOptions() {
{
return _endOfWeekWithOptions;
}
},
endOfWeek: function endOfWeek() {
{
return endOfWeek4;
}
},
endOfSecond: function endOfSecond() {
{
return endOfSecond3;
}
},
endOfQuarter: function endOfQuarter() {
{
return endOfQuarter3;
}
},
endOfMonth: function endOfMonth() {
{
return endOfMonth5;
}
},
endOfMinute: function endOfMinute() {
{
return endOfMinute3;
}
},
endOfISOWeekYear: function endOfISOWeekYear() {
{
return endOfISOWeekYear3;
}
},
endOfISOWeek: function endOfISOWeek() {
{
return endOfISOWeek3;
}
},
endOfHour: function endOfHour() {
{
return endOfHour3;
}
},
endOfDecade: function endOfDecade() {
{
return endOfDecade3;
}
},
endOfDay: function endOfDay() {
{
return endOfDay4;
}
},
eachYearOfIntervalWithOptions: function eachYearOfIntervalWithOptions() {
{
return _eachYearOfIntervalWithOptions;
}
},
eachYearOfInterval: function eachYearOfInterval() {
{
return eachYearOfInterval3;
}
},
eachWeekendOfYear: function eachWeekendOfYear() {
{
return eachWeekendOfYear3;
}
},
eachWeekendOfMonth: function eachWeekendOfMonth() {
{
return eachWeekendOfMonth3;
}
},
eachWeekendOfInterval: function eachWeekendOfInterval() {
{
return eachWeekendOfInterval3;
}
},
eachWeekOfIntervalWithOptions: function eachWeekOfIntervalWithOptions() {
{
return _eachWeekOfIntervalWithOptions;
}
},
eachWeekOfInterval: function eachWeekOfInterval() {
{
return eachWeekOfInterval3;
}
},
eachQuarterOfIntervalWithOptions: function eachQuarterOfIntervalWithOptions() {
{
return _eachQuarterOfIntervalWithOptions;
}
},
eachQuarterOfInterval: function eachQuarterOfInterval() {
{
return eachQuarterOfInterval3;
}
},
eachMonthOfIntervalWithOptions: function eachMonthOfIntervalWithOptions() {
{
return _eachMonthOfIntervalWithOptions;
}
},
eachMonthOfInterval: function eachMonthOfInterval() {
{
return eachMonthOfInterval3;
}
},
eachMinuteOfIntervalWithOptions: function eachMinuteOfIntervalWithOptions() {
{
return _eachMinuteOfIntervalWithOptions;
}
},
eachMinuteOfInterval: function eachMinuteOfInterval() {
{
return eachMinuteOfInterval3;
}
},
eachHourOfIntervalWithOptions: function eachHourOfIntervalWithOptions() {
{
return _eachHourOfIntervalWithOptions;
}
},
eachHourOfInterval: function eachHourOfInterval() {
{
return eachHourOfInterval3;
}
},
eachDayOfIntervalWithOptions: function eachDayOfIntervalWithOptions() {
{
return _eachDayOfIntervalWithOptions;
}
},
eachDayOfInterval: function eachDayOfInterval() {
{
return eachDayOfInterval3;
}
},
differenceInYears: function differenceInYears() {
{
return differenceInYears3;
}
},
differenceInWeeksWithOptions: function differenceInWeeksWithOptions() {
{
return _differenceInWeeksWithOptions;
}
},
differenceInWeeks: function differenceInWeeks() {
{
return differenceInWeeks3;
}
},
differenceInSecondsWithOptions: function differenceInSecondsWithOptions() {
{
return _differenceInSecondsWithOptions;
}
},
differenceInSeconds: function differenceInSeconds() {
{
return differenceInSeconds3;
}
},
differenceInQuartersWithOptions: function differenceInQuartersWithOptions() {
{
return _differenceInQuartersWithOptions;
}
},
differenceInQuarters: function differenceInQuarters() {
{
return differenceInQuarters3;
}
},
differenceInMonths: function differenceInMonths() {
{
return differenceInMonths3;
}
},
differenceInMinutesWithOptions: function differenceInMinutesWithOptions() {
{
return _differenceInMinutesWithOptions;
}
},
differenceInMinutes: function differenceInMinutes() {
{
return differenceInMinutes3;
}
},
differenceInMilliseconds: function differenceInMilliseconds() {
{
return differenceInMilliseconds4;
}
},
differenceInISOWeekYears: function differenceInISOWeekYears() {
{
return differenceInISOWeekYears3;
}
},
differenceInHoursWithOptions: function differenceInHoursWithOptions() {
{
return _differenceInHoursWithOptions;
}
},
differenceInHours: function differenceInHours() {
{
return differenceInHours3;
}
},
differenceInDays: function differenceInDays() {
{
return differenceInDays3;
}
},
differenceInCalendarYears: function differenceInCalendarYears() {
{
return differenceInCalendarYears3;
}
},
differenceInCalendarWeeksWithOptions: function differenceInCalendarWeeksWithOptions() {
{
return _differenceInCalendarWeeksWithOptions;
}
},
differenceInCalendarWeeks: function differenceInCalendarWeeks() {
{
return differenceInCalendarWeeks3;
}
},
differenceInCalendarQuarters: function differenceInCalendarQuarters() {
{
return differenceInCalendarQuarters3;
}
},
differenceInCalendarMonths: function differenceInCalendarMonths() {
{
return differenceInCalendarMonths3;
}
},
differenceInCalendarISOWeeks: function differenceInCalendarISOWeeks() {
{
return differenceInCalendarISOWeeks3;
}
},
differenceInCalendarISOWeekYears: function differenceInCalendarISOWeekYears() {
{
return differenceInCalendarISOWeekYears3;
}
},
differenceInCalendarDays: function differenceInCalendarDays() {
{
return differenceInCalendarDays5;
}
},
differenceInBusinessDays: function differenceInBusinessDays() {
{
return differenceInBusinessDays3;
}
},
daysToWeeks: function daysToWeeks() {
{
return daysToWeeks3;
}
},
constructFrom: function constructFrom() {
{
return constructFrom12;
}
},
compareDesc: function compareDesc() {
{
return compareDesc3;
}
},
compareAsc: function compareAsc() {
{
return compareAsc3;
}
},
closestTo: function closestTo() {
{
return closestTo3;
}
},
closestIndexTo: function closestIndexTo() {
{
return closestIndexTo3;
}
},
clamp: function clamp() {
{
return clamp3;
}
},
areIntervalsOverlappingWithOptions: function areIntervalsOverlappingWithOptions() {
{
return _areIntervalsOverlappingWithOptions;
}
},
areIntervalsOverlapping: function areIntervalsOverlapping() {
{
return areIntervalsOverlapping3;
}
},
addYears: function addYears() {
{
return addYears3;
}
},
addWeeks: function addWeeks() {
{
return addWeeks3;
}
},
addSeconds: function addSeconds() {
{
return addSeconds3;
}
},
addQuarters: function addQuarters() {
{
return addQuarters3;
}
},
addMonths: function addMonths() {
{
return addMonths4;
}
},
addMinutes: function addMinutes() {
{
return addMinutes3;
}
},
addMilliseconds: function addMilliseconds() {
{
return addMilliseconds4;
}
},
addISOWeekYears: function addISOWeekYears() {
{
return addISOWeekYears3;
}
},
addHours: function addHours() {
{
return addHours3;
}
},
addDays: function addDays() {
{
return addDays4;
}
},
addBusinessDays: function addBusinessDays() {
{
return addBusinessDays3;
}
},
add: function add() {
{
return add3;
}
}
});
// lib/toDate.mjs
function toDate(argument) {
var 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 new Date(NaN);
}
}
// lib/constructFrom.mjs
function constructFrom(date, value) {
if (date instanceof Date) {
return new date.constructor(value);
} else {
return new Date(value);
}
}
// lib/addDays.mjs
function addDays(date, amount) {
var _date = toDate(date);
if (isNaN(amount))
return constructFrom(date, NaN);
if (!amount) {
return _date;
}
_date.setDate(_date.getDate() + amount);
return _date;
}
// lib/addMonths.mjs
function addMonths(date, amount) {
var _date = toDate(date);
if (isNaN(amount))
return constructFrom(date, NaN);
if (!amount) {
return _date;
}
var dayOfMonth = _date.getDate();
var endOfDesiredMonth = constructFrom(date, _date.getTime());
endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
var daysInMonth = endOfDesiredMonth.getDate();
if (dayOfMonth >= daysInMonth) {
return endOfDesiredMonth;
} else {
_date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
return _date;
}
}
// lib/add.mjs
function add(date, duration) {
var _duration$years =
duration.years,years = _duration$years === void 0 ? 0 : _duration$years,_duration$months = duration.months,months = _duration$months === void 0 ? 0 : _duration$months,_duration$weeks = duration.weeks,weeks = _duration$weeks === void 0 ? 0 : _duration$weeks,_duration$days = duration.days,days = _duration$days === void 0 ? 0 : _duration$days,_duration$hours = duration.hours,hours = _duration$hours === void 0 ? 0 : _duration$hours,_duration$minutes = duration.minutes,minutes = _duration$minutes === void 0 ? 0 : _duration$minutes,_duration$seconds = duration.seconds,seconds = _duration$seconds === void 0 ? 0 : _duration$seconds;
var _date = toDate(date);
var dateWithMonths = months || years ? addMonths(_date, months + years * 12) : _date;
var dateWithDays = days || weeks ? addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;
var minutesToAdd = minutes + hours * 60;
var secondsToAdd = seconds + minutesToAdd * 60;
var msToAdd = secondsToAdd * 1000;
var finalDate = constructFrom(date, dateWithDays.getTime() + msToAdd);
return finalDate;
}
// lib/fp/_lib/convertToFP.mjs
function convertToFP(fn, arity) {var curriedArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
return curriedArgs.length >= arity ? fn.apply(void 0, _toConsumableArray(curriedArgs.slice(0, arity).reverse())) : function () {for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}return convertToFP(fn, arity, curriedArgs.concat(args));};
}
// lib/fp/add.mjs
var add3 = convertToFP(add, 2);
// lib/isSaturday.mjs
function isSaturday(date) {
return toDate(date).getDay() === 6;
}
// lib/isSunday.mjs
function isSunday(date) {
return toDate(date).getDay() === 0;
}
// lib/isWeekend.mjs
function isWeekend(date) {
var day = toDate(date).getDay();
return day === 0 || day === 6;
}
// lib/addBusinessDays.mjs
function addBusinessDays(date, amount) {
var _date = toDate(date);
var startedOnWeekend = isWeekend(_date);
if (isNaN(amount))
return constructFrom(date, NaN);
var hours = _date.getHours();
var sign = amount < 0 ? -1 : 1;
var fullWeeks = Math.trunc(amount / 5);
_date.setDate(_date.getDate() + fullWeeks * 7);
var 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;
}
// lib/fp/addBusinessDays.mjs
var addBusinessDays3 = convertToFP(addBusinessDays, 2);
// lib/fp/addDays.mjs
var addDays4 = convertToFP(addDays, 2);
// lib/addMilliseconds.mjs
function addMilliseconds(date, amount) {
var timestamp = +toDate(date);
return constructFrom(date, timestamp + amount);
}
// lib/constants.mjs
var daysInWeek = 7;
var daysInYear = 365.2425;
var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
var minTime = -maxTime;
var millisecondsInWeek = 604800000;
var millisecondsInDay = 86400000;
var millisecondsInMinute = 60000;
var millisecondsInHour = 3600000;
var millisecondsInSecond = 1000;
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;
// lib/addHours.mjs
function addHours(date, amount) {
return addMilliseconds(date, amount * millisecondsInHour);
}
// lib/fp/addHours.mjs
var addHours3 = convertToFP(addHours, 2);
// lib/_lib/defaultOptions.mjs
function getDefaultOptions() {
return defaultOptions;
}
function setDefaultOptions(newOptions) {
defaultOptions = newOptions;
}
var defaultOptions = {};
// lib/startOfWeek.mjs
function startOfWeek(date, options) {var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _defaultOptions3$loca;
var defaultOptions3 = getDefaultOptions();
var weekStartsOn = (_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 || (_options$locale = options.locale) === null || _options$locale === void 0 || (_options$locale = _options$locale.options) === null || _options$locale === void 0 ? void 0 : _options$locale.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions3.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions3$loca = defaultOptions3.locale) === null || _defaultOptions3$loca === void 0 || (_defaultOptions3$loca = _defaultOptions3$loca.options) === null || _defaultOptions3$loca === void 0 ? void 0 : _defaultOptions3$loca.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0;
var _date = toDate(date);
var day = _date.getDay();
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
_date.setDate(_date.getDate() - diff);
_date.setHours(0, 0, 0, 0);
return _date;
}
// lib/startOfISOWeek.mjs
function startOfISOWeek(date) {
return startOfWeek(date, { weekStartsOn: 1 });
}
// lib/getISOWeekYear.mjs
function getISOWeekYear(date) {
var _date = toDate(date);
var year = _date.getFullYear();
var fourthOfJanuaryOfNextYear = constructFrom(date, 0);
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
var startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
var fourthOfJanuaryOfThisYear = constructFrom(date, 0);
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
var startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
if (_date.getTime() >= startOfNextYear.getTime()) {
return year + 1;
} else if (_date.getTime() >= startOfThisYear.getTime()) {
return year;
} else {
return year - 1;
}
}
// lib/startOfDay.mjs
function startOfDay(date) {
var _date = toDate(date);
_date.setHours(0, 0, 0, 0);
return _date;
}
// lib/_lib/getTimezoneOffsetInMilliseconds.mjs
function getTimezoneOffsetInMilliseconds(date) {
var _date = toDate(date);
var utcDate = new Date(Date.UTC(_date.getFullYear(), _date.getMonth(), _date.getDate(), _date.getHours(), _date.getMinutes(), _date.getSeconds(), _date.getMilliseconds()));
utcDate.setUTCFullYear(_date.getFullYear());
return +date - +utcDate;
}
// lib/differenceInCalendarDays.mjs
function differenceInCalendarDays(dateLeft, dateRight) {
var startOfDayLeft = startOfDay(dateLeft);
var startOfDayRight = startOfDay(dateRight);
var timestampLeft = +startOfDayLeft - getTimezoneOffsetInMilliseconds(startOfDayLeft);
var timestampRight = +startOfDayRight - getTimezoneOffsetInMilliseconds(startOfDayRight);
return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
}
// lib/startOfISOWeekYear.mjs
function startOfISOWeekYear(date) {
var year = getISOWeekYear(date);
var fourthOfJanuary = constructFrom(date, 0);
fourthOfJanuary.setFullYear(year, 0, 4);
fourthOfJanuary.setHours(0, 0, 0, 0);
return startOfISOWeek(fourthOfJanuary);
}
// lib/setISOWeekYear.mjs
function setISOWeekYear(date, weekYear) {
var _date = toDate(date);
var diff = differenceInCalendarDays(_date, startOfISOWeekYear(_date));
var 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;
}
// lib/addISOWeekYears.mjs
function addISOWeekYears(date, amount) {
return setISOWeekYear(date, getISOWeekYear(date) + amount);
}
// lib/fp/addISOWeekYears.mjs
var addISOWeekYears3 = convertToFP(addISOWeekYears, 2);
// lib/fp/addMilliseconds.mjs
var addMilliseconds4 = convertToFP(addMilliseconds, 2);
// lib/addMinutes.mjs
function addMinutes(date, amount) {
return addMilliseconds(date, amount * millisecondsInMinute);
}
// lib/fp/addMinutes.mjs
var addMinutes3 = convertToFP(addMinutes, 2);
// lib/fp/addMonths.mjs
var addMonths4 = convertToFP(addMonths, 2);
// lib/addQuarters.mjs
function addQuarters(date, amount) {
var months = amount * 3;
return addMonths(date, months);
}
// lib/fp/addQuarters.mjs
var addQuarters3 = convertToFP(addQuarters, 2);
// lib/addSeconds.mjs
function addSeconds(date, amount) {
return addMilliseconds(date, amount * 1000);
}
// lib/fp/addSeconds.mjs
var addSeconds3 = convertToFP(addSeconds, 2);
// lib/addWeeks.mjs
function addWeeks(date, amount) {
var days = amount * 7;
return addDays(date, days);
}
// lib/fp/addWeeks.mjs
var addWeeks3 = convertToFP(addWeeks, 2);
// lib/addYears.mjs
function addYears(date, amount) {
return addMonths(date, amount * 12);
}
// lib/fp/addYears.mjs
var addYears3 = convertToFP(addYears, 2);
// lib/areIntervalsOverlapping.mjs
function areIntervalsOverlapping(intervalLeft, intervalRight, options) {
var _sort = [
+toDate(intervalLeft.start),
+toDate(intervalLeft.end)].
sort(function (a, b) {return a - b;}),_sort2 = _slicedToArray(_sort, 2),leftStartTime = _sort2[0],leftEndTime = _sort2[1];
var _sort3 = [
+toDate(intervalRight.start),
+toDate(intervalRight.end)].
sort(function (a, b) {return a - b;}),_sort4 = _slicedToArray(_sort3, 2),rightStartTime = _sort4[0],rightEndTime = _sort4[1];
if (options !== null && options !== void 0 && options.inclusive)
return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime;
return leftStartTime < rightEndTime && rightStartTime < leftEndTime;
}
// lib/fp/areIntervalsOverlapping.mjs
var areIntervalsOverlapping3 = convertToFP(areIntervalsOverlapping, 2);
// lib/fp/areIntervalsOverlappingWithOptions.mjs
var _areIntervalsOverlappingWithOptions = convertToFP(areIntervalsOverlapping, 3);
// lib/max.mjs
function max(dates) {
var result;
dates.forEach(function (dirtyDate) {
var currentDate = toDate(dirtyDate);
if (result === undefined || result < currentDate || isNaN(Number(currentDate))) {
result = currentDate;
}
});
return result || new Date(NaN);
}
// lib/min.mjs
function min(dates) {
var result;
dates.forEach(function (dirtyDate) {
var date = toDate(dirtyDate);
if (!result || result > date || isNaN(+date)) {
result = date;
}
});
return result || new Date(NaN);
}
// lib/clamp.mjs
function clamp(date, interval) {
return min([max([date, interval.start]), interval.end]);
}
// lib/fp/clamp.mjs
var clamp3 = convertToFP(clamp, 2);
// lib/closestIndexTo.mjs
function closestIndexTo(dateToCompare, dates) {
var date = toDate(dateToCompare);
if (isNaN(Number(date)))
return NaN;
var timeToCompare = date.getTime();
var result;
var minDistance;
dates.forEach(function (dirtyDate, index) {
var currentDate = toDate(dirtyDate);
if (isNaN(Number(currentDate))) {
result = NaN;
minDistance = NaN;
return;
}
var distance = Math.abs(timeToCompare - currentDate.getTime());
if (result == null || distance < minDistance) {
result = index;
minDistance = distance;
}
});
return result;
}
// lib/fp/closestIndexTo.mjs
var closestIndexTo3 = convertToFP(closestIndexTo, 2);
// lib/closestTo.mjs
function closestTo(dateToCompare, dates) {
var date = toDate(dateToCompare);
if (isNaN(Number(date)))
return constructFrom(dateToCompare, NaN);
var timeToCompare = date.getTime();
var result;
var minDistance;
dates.forEach(function (dirtyDate) {
var currentDate = toDate(dirtyDate);
if (isNaN(Number(currentDate))) {
result = constructFrom(dateToCompare, NaN);
minDistance = NaN;
return;
}
var distance = Math.abs(timeToCompare - currentDate.getTime());
if (result == null || distance < minDistance) {
result = currentDate;
minDistance = distance;
}
});
return result;
}
// lib/fp/closestTo.mjs
var closestTo3 = convertToFP(closestTo, 2);
// lib/compareAsc.mjs
function compareAsc(dateLeft, dateRight) {
var _dateLeft = toDate(dateLeft);
var _dateRight = toDate(dateRight);
var diff = _dateLeft.getTime() - _dateRight.getTime();
if (d