1 | (() => {
|
2 | 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 _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 _arrayWithoutHoles(arr) {if (Array.isArray(arr)) return _arrayLikeToArray(arr);}function _toArray(arr) {return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();}function _iterableToArray(iter) {if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);}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 _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 _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 _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 ownKeys(e, r) {var t = Object.keys(e);if (Object.getOwnPropertySymbols) {var o = Object.getOwnPropertySymbols(e);r && (o = o.filter(function (r) {return Object.getOwnPropertyDescriptor(e, r).enumerable;})), t.push.apply(t, o);}return t;}function _objectSpread(e) {for (var r = 1; r < arguments.length; r++) {var t = null != arguments[r] ? arguments[r] : {};r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {_defineProperty(e, r, t[r]);}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));});}return e;}function _defineProperty(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 _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);}var __defProp = Object.defineProperty;
|
3 | var __export = function __export(target, all) {
|
4 | for (var name in all)
|
5 | __defProp(target, name, {
|
6 | get: all[name],
|
7 | enumerable: true,
|
8 | configurable: true,
|
9 | set: function set(newValue) {return all[name] = function () {return newValue;};}
|
10 | });
|
11 | };
|
12 |
|
13 |
|
14 | var exports_lib = {};
|
15 | __export(exports_lib, {
|
16 | yearsToQuarters: function yearsToQuarters() {return _yearsToQuarters;},
|
17 | yearsToMonths: function yearsToMonths() {return _yearsToMonths;},
|
18 | yearsToDays: function yearsToDays() {return _yearsToDays;},
|
19 | weeksToDays: function weeksToDays() {return _weeksToDays;},
|
20 | transpose: function transpose() {return _transpose;},
|
21 | toDate: function toDate() {return _toDate;},
|
22 | subYears: function subYears() {return _subYears;},
|
23 | subWeeks: function subWeeks() {return _subWeeks;},
|
24 | subSeconds: function subSeconds() {return _subSeconds;},
|
25 | subQuarters: function subQuarters() {return _subQuarters;},
|
26 | subMonths: function subMonths() {return _subMonths;},
|
27 | subMinutes: function subMinutes() {return _subMinutes;},
|
28 | subMilliseconds: function subMilliseconds() {return _subMilliseconds;},
|
29 | subISOWeekYears: function subISOWeekYears() {return _subISOWeekYears;},
|
30 | subHours: function subHours() {return _subHours;},
|
31 | subDays: function subDays() {return _subDays;},
|
32 | subBusinessDays: function subBusinessDays() {return _subBusinessDays;},
|
33 | sub: function sub() {return _sub;},
|
34 | startOfYesterday: function startOfYesterday() {return _startOfYesterday;},
|
35 | startOfYear: function startOfYear() {return _startOfYear;},
|
36 | startOfWeekYear: function startOfWeekYear() {return _startOfWeekYear;},
|
37 | startOfWeek: function startOfWeek() {return _startOfWeek;},
|
38 | startOfTomorrow: function startOfTomorrow() {return _startOfTomorrow;},
|
39 | startOfToday: function startOfToday() {return _startOfToday;},
|
40 | startOfSecond: function startOfSecond() {return _startOfSecond;},
|
41 | startOfQuarter: function startOfQuarter() {return _startOfQuarter;},
|
42 | startOfMonth: function startOfMonth() {return _startOfMonth;},
|
43 | startOfMinute: function startOfMinute() {return _startOfMinute;},
|
44 | startOfISOWeekYear: function startOfISOWeekYear() {return _startOfISOWeekYear;},
|
45 | startOfISOWeek: function startOfISOWeek() {return _startOfISOWeek;},
|
46 | startOfHour: function startOfHour() {return _startOfHour;},
|
47 | startOfDecade: function startOfDecade() {return _startOfDecade;},
|
48 | startOfDay: function startOfDay() {return _startOfDay;},
|
49 | setYear: function setYear() {return _setYear;},
|
50 | setWeekYear: function setWeekYear() {return _setWeekYear;},
|
51 | setWeek: function setWeek() {return _setWeek;},
|
52 | setSeconds: function setSeconds() {return _setSeconds;},
|
53 | setQuarter: function setQuarter() {return _setQuarter;},
|
54 | setMonth: function setMonth() {return _setMonth;},
|
55 | setMinutes: function setMinutes() {return _setMinutes;},
|
56 | setMilliseconds: function setMilliseconds() {return _setMilliseconds;},
|
57 | setISOWeekYear: function setISOWeekYear() {return _setISOWeekYear;},
|
58 | setISOWeek: function setISOWeek() {return _setISOWeek;},
|
59 | setISODay: function setISODay() {return _setISODay;},
|
60 | setHours: function setHours() {return _setHours;},
|
61 | setDefaultOptions: function setDefaultOptions() {return setDefaultOptions2;},
|
62 | setDayOfYear: function setDayOfYear() {return _setDayOfYear;},
|
63 | setDay: function setDay() {return _setDay;},
|
64 | setDate: function setDate() {return _setDate;},
|
65 | set: function set() {return _set;},
|
66 | secondsToMinutes: function secondsToMinutes() {return _secondsToMinutes;},
|
67 | secondsToMilliseconds: function secondsToMilliseconds() {return _secondsToMilliseconds;},
|
68 | secondsToHours: function secondsToHours() {return _secondsToHours;},
|
69 | roundToNearestMinutes: function roundToNearestMinutes() {return _roundToNearestMinutes;},
|
70 | roundToNearestHours: function roundToNearestHours() {return _roundToNearestHours;},
|
71 | quartersToYears: function quartersToYears() {return _quartersToYears;},
|
72 | quartersToMonths: function quartersToMonths() {return _quartersToMonths;},
|
73 | previousWednesday: function previousWednesday() {return _previousWednesday;},
|
74 | previousTuesday: function previousTuesday() {return _previousTuesday;},
|
75 | previousThursday: function previousThursday() {return _previousThursday;},
|
76 | previousSunday: function previousSunday() {return _previousSunday;},
|
77 | previousSaturday: function previousSaturday() {return _previousSaturday;},
|
78 | previousMonday: function previousMonday() {return _previousMonday;},
|
79 | previousFriday: function previousFriday() {return _previousFriday;},
|
80 | previousDay: function previousDay() {return _previousDay;},
|
81 | parsers: function parsers() {return _parsers;},
|
82 | parseJSON: function parseJSON() {return _parseJSON;},
|
83 | parseISO: function parseISO() {return _parseISO;},
|
84 | parse: function parse() {return _parse;},
|
85 | nextWednesday: function nextWednesday() {return _nextWednesday;},
|
86 | nextTuesday: function nextTuesday() {return _nextTuesday;},
|
87 | nextThursday: function nextThursday() {return _nextThursday;},
|
88 | nextSunday: function nextSunday() {return _nextSunday;},
|
89 | nextSaturday: function nextSaturday() {return _nextSaturday;},
|
90 | nextMonday: function nextMonday() {return _nextMonday;},
|
91 | nextFriday: function nextFriday() {return _nextFriday;},
|
92 | nextDay: function nextDay() {return _nextDay;},
|
93 | monthsToYears: function monthsToYears() {return _monthsToYears;},
|
94 | monthsToQuarters: function monthsToQuarters() {return _monthsToQuarters;},
|
95 | minutesToSeconds: function minutesToSeconds() {return _minutesToSeconds;},
|
96 | minutesToMilliseconds: function minutesToMilliseconds() {return _minutesToMilliseconds;},
|
97 | minutesToHours: function minutesToHours() {return _minutesToHours;},
|
98 | min: function min() {return _min;},
|
99 | millisecondsToSeconds: function millisecondsToSeconds() {return _millisecondsToSeconds;},
|
100 | millisecondsToMinutes: function millisecondsToMinutes() {return _millisecondsToMinutes;},
|
101 | millisecondsToHours: function millisecondsToHours() {return _millisecondsToHours;},
|
102 | milliseconds: function milliseconds() {return _milliseconds;},
|
103 | max: function max() {return _max;},
|
104 | longFormatters: function longFormatters() {return _longFormatters;},
|
105 | lightFormatters: function lightFormatters() {return _lightFormatters;},
|
106 | lightFormat: function lightFormat() {return _lightFormat;},
|
107 | lastDayOfYear: function lastDayOfYear() {return _lastDayOfYear;},
|
108 | lastDayOfWeek: function lastDayOfWeek() {return _lastDayOfWeek;},
|
109 | lastDayOfQuarter: function lastDayOfQuarter() {return _lastDayOfQuarter;},
|
110 | lastDayOfMonth: function lastDayOfMonth() {return _lastDayOfMonth;},
|
111 | lastDayOfISOWeekYear: function lastDayOfISOWeekYear() {return _lastDayOfISOWeekYear;},
|
112 | lastDayOfISOWeek: function lastDayOfISOWeek() {return _lastDayOfISOWeek;},
|
113 | lastDayOfDecade: function lastDayOfDecade() {return _lastDayOfDecade;},
|
114 | isYesterday: function isYesterday() {return _isYesterday;},
|
115 | isWithinInterval: function isWithinInterval() {return _isWithinInterval;},
|
116 | isWeekend: function isWeekend() {return _isWeekend;},
|
117 | isWednesday: function isWednesday() {return _isWednesday;},
|
118 | isValid: function isValid() {return _isValid;},
|
119 | isTuesday: function isTuesday() {return _isTuesday;},
|
120 | isTomorrow: function isTomorrow() {return _isTomorrow;},
|
121 | isToday: function isToday() {return _isToday;},
|
122 | isThursday: function isThursday() {return _isThursday;},
|
123 | isThisYear: function isThisYear() {return _isThisYear;},
|
124 | isThisWeek: function isThisWeek() {return _isThisWeek;},
|
125 | isThisSecond: function isThisSecond() {return _isThisSecond;},
|
126 | isThisQuarter: function isThisQuarter() {return _isThisQuarter;},
|
127 | isThisMonth: function isThisMonth() {return _isThisMonth;},
|
128 | isThisMinute: function isThisMinute() {return _isThisMinute;},
|
129 | isThisISOWeek: function isThisISOWeek() {return _isThisISOWeek;},
|
130 | isThisHour: function isThisHour() {return _isThisHour;},
|
131 | isSunday: function isSunday() {return _isSunday;},
|
132 | isSaturday: function isSaturday() {return _isSaturday;},
|
133 | isSameYear: function isSameYear() {return _isSameYear;},
|
134 | isSameWeek: function isSameWeek() {return _isSameWeek;},
|
135 | isSameSecond: function isSameSecond() {return _isSameSecond;},
|
136 | isSameQuarter: function isSameQuarter() {return _isSameQuarter;},
|
137 | isSameMonth: function isSameMonth() {return _isSameMonth;},
|
138 | isSameMinute: function isSameMinute() {return _isSameMinute;},
|
139 | isSameISOWeekYear: function isSameISOWeekYear() {return _isSameISOWeekYear;},
|
140 | isSameISOWeek: function isSameISOWeek() {return _isSameISOWeek;},
|
141 | isSameHour: function isSameHour() {return _isSameHour;},
|
142 | isSameDay: function isSameDay() {return _isSameDay;},
|
143 | isPast: function isPast() {return _isPast;},
|
144 | isMonday: function isMonday() {return _isMonday;},
|
145 | isMatch: function isMatch() {return _isMatch;},
|
146 | isLeapYear: function isLeapYear() {return _isLeapYear;},
|
147 | isLastDayOfMonth: function isLastDayOfMonth() {return _isLastDayOfMonth;},
|
148 | isFuture: function isFuture() {return _isFuture;},
|
149 | isFriday: function isFriday() {return _isFriday;},
|
150 | isFirstDayOfMonth: function isFirstDayOfMonth() {return _isFirstDayOfMonth;},
|
151 | isExists: function isExists() {return _isExists;},
|
152 | isEqual: function isEqual() {return _isEqual;},
|
153 | isDate: function isDate() {return _isDate;},
|
154 | isBefore: function isBefore() {return _isBefore;},
|
155 | isAfter: function isAfter() {return _isAfter;},
|
156 | intlFormatDistance: function intlFormatDistance() {return _intlFormatDistance;},
|
157 | intlFormat: function intlFormat() {return _intlFormat;},
|
158 | intervalToDuration: function intervalToDuration() {return _intervalToDuration;},
|
159 | interval: function interval() {return _interval;},
|
160 | hoursToSeconds: function hoursToSeconds() {return _hoursToSeconds;},
|
161 | hoursToMinutes: function hoursToMinutes() {return _hoursToMinutes;},
|
162 | hoursToMilliseconds: function hoursToMilliseconds() {return _hoursToMilliseconds;},
|
163 | getYear: function getYear() {return _getYear;},
|
164 | getWeeksInMonth: function getWeeksInMonth() {return _getWeeksInMonth;},
|
165 | getWeekYear: function getWeekYear() {return _getWeekYear;},
|
166 | getWeekOfMonth: function getWeekOfMonth() {return _getWeekOfMonth;},
|
167 | getWeek: function getWeek() {return _getWeek;},
|
168 | getUnixTime: function getUnixTime() {return _getUnixTime;},
|
169 | getTime: function getTime() {return _getTime;},
|
170 | getSeconds: function getSeconds() {return _getSeconds;},
|
171 | getQuarter: function getQuarter() {return _getQuarter;},
|
172 | getOverlappingDaysInIntervals: function getOverlappingDaysInIntervals() {return _getOverlappingDaysInIntervals;},
|
173 | getMonth: function getMonth() {return _getMonth;},
|
174 | getMinutes: function getMinutes() {return _getMinutes;},
|
175 | getMilliseconds: function getMilliseconds() {return _getMilliseconds;},
|
176 | getISOWeeksInYear: function getISOWeeksInYear() {return _getISOWeeksInYear;},
|
177 | getISOWeekYear: function getISOWeekYear() {return _getISOWeekYear;},
|
178 | getISOWeek: function getISOWeek() {return _getISOWeek;},
|
179 | getISODay: function getISODay() {return _getISODay;},
|
180 | getHours: function getHours() {return _getHours;},
|
181 | getDefaultOptions: function getDefaultOptions() {return getDefaultOptions2;},
|
182 | getDecade: function getDecade() {return _getDecade;},
|
183 | getDaysInYear: function getDaysInYear() {return _getDaysInYear;},
|
184 | getDaysInMonth: function getDaysInMonth() {return _getDaysInMonth;},
|
185 | getDayOfYear: function getDayOfYear() {return _getDayOfYear;},
|
186 | getDay: function getDay() {return _getDay;},
|
187 | getDate: function getDate() {return _getDate;},
|
188 | fromUnixTime: function fromUnixTime() {return _fromUnixTime;},
|
189 | formatters: function formatters() {return _formatters;},
|
190 | formatRelative: function formatRelative() {return formatRelative3;},
|
191 | formatRFC7231: function formatRFC7231() {return _formatRFC;},
|
192 | formatRFC3339: function formatRFC3339() {return _formatRFC2;},
|
193 | formatISODuration: function formatISODuration() {return _formatISODuration;},
|
194 | formatISO9075: function formatISO9075() {return _formatISO;},
|
195 | formatISO: function formatISO() {return _formatISO2;},
|
196 | formatDuration: function formatDuration() {return _formatDuration;},
|
197 | formatDistanceToNowStrict: function formatDistanceToNowStrict() {return _formatDistanceToNowStrict;},
|
198 | formatDistanceToNow: function formatDistanceToNow() {return _formatDistanceToNow;},
|
199 | formatDistanceStrict: function formatDistanceStrict() {return _formatDistanceStrict;},
|
200 | formatDistance: function formatDistance() {return formatDistance3;},
|
201 | formatDate: function formatDate() {return _format;},
|
202 | format: function format() {return _format;},
|
203 | endOfYesterday: function endOfYesterday() {return _endOfYesterday;},
|
204 | endOfYear: function endOfYear() {return _endOfYear;},
|
205 | endOfWeek: function endOfWeek() {return _endOfWeek;},
|
206 | endOfTomorrow: function endOfTomorrow() {return _endOfTomorrow;},
|
207 | endOfToday: function endOfToday() {return _endOfToday;},
|
208 | endOfSecond: function endOfSecond() {return _endOfSecond;},
|
209 | endOfQuarter: function endOfQuarter() {return _endOfQuarter;},
|
210 | endOfMonth: function endOfMonth() {return _endOfMonth;},
|
211 | endOfMinute: function endOfMinute() {return _endOfMinute;},
|
212 | endOfISOWeekYear: function endOfISOWeekYear() {return _endOfISOWeekYear;},
|
213 | endOfISOWeek: function endOfISOWeek() {return _endOfISOWeek;},
|
214 | endOfHour: function endOfHour() {return _endOfHour;},
|
215 | endOfDecade: function endOfDecade() {return _endOfDecade;},
|
216 | endOfDay: function endOfDay() {return _endOfDay;},
|
217 | eachYearOfInterval: function eachYearOfInterval() {return _eachYearOfInterval;},
|
218 | eachWeekendOfYear: function eachWeekendOfYear() {return _eachWeekendOfYear;},
|
219 | eachWeekendOfMonth: function eachWeekendOfMonth() {return _eachWeekendOfMonth;},
|
220 | eachWeekendOfInterval: function eachWeekendOfInterval() {return _eachWeekendOfInterval;},
|
221 | eachWeekOfInterval: function eachWeekOfInterval() {return _eachWeekOfInterval;},
|
222 | eachQuarterOfInterval: function eachQuarterOfInterval() {return _eachQuarterOfInterval;},
|
223 | eachMonthOfInterval: function eachMonthOfInterval() {return _eachMonthOfInterval;},
|
224 | eachMinuteOfInterval: function eachMinuteOfInterval() {return _eachMinuteOfInterval;},
|
225 | eachHourOfInterval: function eachHourOfInterval() {return _eachHourOfInterval;},
|
226 | eachDayOfInterval: function eachDayOfInterval() {return _eachDayOfInterval;},
|
227 | differenceInYears: function differenceInYears() {return _differenceInYears;},
|
228 | differenceInWeeks: function differenceInWeeks() {return _differenceInWeeks;},
|
229 | differenceInSeconds: function differenceInSeconds() {return _differenceInSeconds;},
|
230 | differenceInQuarters: function differenceInQuarters() {return _differenceInQuarters;},
|
231 | differenceInMonths: function differenceInMonths() {return _differenceInMonths;},
|
232 | differenceInMinutes: function differenceInMinutes() {return _differenceInMinutes;},
|
233 | differenceInMilliseconds: function differenceInMilliseconds() {return _differenceInMilliseconds;},
|
234 | differenceInISOWeekYears: function differenceInISOWeekYears() {return _differenceInISOWeekYears;},
|
235 | differenceInHours: function differenceInHours() {return _differenceInHours;},
|
236 | differenceInDays: function differenceInDays() {return _differenceInDays;},
|
237 | differenceInCalendarYears: function differenceInCalendarYears() {return _differenceInCalendarYears;},
|
238 | differenceInCalendarWeeks: function differenceInCalendarWeeks() {return _differenceInCalendarWeeks;},
|
239 | differenceInCalendarQuarters: function differenceInCalendarQuarters() {return _differenceInCalendarQuarters;},
|
240 | differenceInCalendarMonths: function differenceInCalendarMonths() {return _differenceInCalendarMonths;},
|
241 | differenceInCalendarISOWeeks: function differenceInCalendarISOWeeks() {return _differenceInCalendarISOWeeks;},
|
242 | differenceInCalendarISOWeekYears: function differenceInCalendarISOWeekYears() {return _differenceInCalendarISOWeekYears;},
|
243 | differenceInCalendarDays: function differenceInCalendarDays() {return _differenceInCalendarDays;},
|
244 | differenceInBusinessDays: function differenceInBusinessDays() {return _differenceInBusinessDays;},
|
245 | daysToWeeks: function daysToWeeks() {return _daysToWeeks;},
|
246 | constructNow: function constructNow() {return _constructNow;},
|
247 | constructFrom: function constructFrom() {return _constructFrom;},
|
248 | compareDesc: function compareDesc() {return _compareDesc;},
|
249 | compareAsc: function compareAsc() {return _compareAsc;},
|
250 | closestTo: function closestTo() {return _closestTo;},
|
251 | closestIndexTo: function closestIndexTo() {return _closestIndexTo;},
|
252 | clamp: function clamp() {return _clamp;},
|
253 | areIntervalsOverlapping: function areIntervalsOverlapping() {return _areIntervalsOverlapping;},
|
254 | addYears: function addYears() {return _addYears;},
|
255 | addWeeks: function addWeeks() {return _addWeeks;},
|
256 | addSeconds: function addSeconds() {return _addSeconds;},
|
257 | addQuarters: function addQuarters() {return _addQuarters;},
|
258 | addMonths: function addMonths() {return _addMonths;},
|
259 | addMinutes: function addMinutes() {return _addMinutes;},
|
260 | addMilliseconds: function addMilliseconds() {return _addMilliseconds;},
|
261 | addISOWeekYears: function addISOWeekYears() {return _addISOWeekYears;},
|
262 | addHours: function addHours() {return _addHours;},
|
263 | addDays: function addDays() {return _addDays;},
|
264 | addBusinessDays: function addBusinessDays() {return _addBusinessDays;},
|
265 | add: function add() {return _add;}
|
266 | });
|
267 |
|
268 |
|
269 | var daysInWeek = 7;
|
270 | var daysInYear = 365.2425;
|
271 | var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
|
272 | var minTime = -maxTime;
|
273 | var millisecondsInWeek = 604800000;
|
274 | var millisecondsInDay = 86400000;
|
275 | var millisecondsInMinute = 60000;
|
276 | var millisecondsInHour = 3600000;
|
277 | var millisecondsInSecond = 1000;
|
278 | var minutesInYear = 525600;
|
279 | var minutesInMonth = 43200;
|
280 | var minutesInDay = 1440;
|
281 | var minutesInHour = 60;
|
282 | var monthsInQuarter = 3;
|
283 | var monthsInYear = 12;
|
284 | var quartersInYear = 4;
|
285 | var secondsInHour = 3600;
|
286 | var secondsInMinute = 60;
|
287 | var secondsInDay = secondsInHour * 24;
|
288 | var secondsInWeek = secondsInDay * 7;
|
289 | var secondsInYear = secondsInDay * daysInYear;
|
290 | var secondsInMonth = secondsInYear / 12;
|
291 | var secondsInQuarter = secondsInMonth * 3;
|
292 | var constructFromSymbol = Symbol.for("constructDateFrom");
|
293 |
|
294 |
|
295 | function _constructFrom(date, value) {
|
296 | if (typeof date === "function")
|
297 | return date(value);
|
298 | if (date && _typeof(date) === "object" && constructFromSymbol in date)
|
299 | return date[constructFromSymbol](value);
|
300 | if (date instanceof Date)
|
301 | return new date.constructor(value);
|
302 | return new Date(value);
|
303 | }
|
304 |
|
305 |
|
306 | function _toDate(argument, context) {
|
307 | return _constructFrom(context || argument, argument);
|
308 | }
|
309 |
|
310 |
|
311 | function _addDays(date, amount, options) {
|
312 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
313 | if (isNaN(amount))
|
314 | return _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, NaN);
|
315 | if (!amount)
|
316 | return _date;
|
317 | _date.setDate(_date.getDate() + amount);
|
318 | return _date;
|
319 | }
|
320 |
|
321 |
|
322 | function _addMonths(date, amount, options) {
|
323 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
324 | if (isNaN(amount))
|
325 | return _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, NaN);
|
326 | if (!amount) {
|
327 | return _date;
|
328 | }
|
329 | var dayOfMonth = _date.getDate();
|
330 | var endOfDesiredMonth = _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, _date.getTime());
|
331 | endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
|
332 | var daysInMonth = endOfDesiredMonth.getDate();
|
333 | if (dayOfMonth >= daysInMonth) {
|
334 | return endOfDesiredMonth;
|
335 | } else {
|
336 | _date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
|
337 | return _date;
|
338 | }
|
339 | }
|
340 |
|
341 |
|
342 | function _add(date, duration, options) {
|
343 | var _duration$years =
|
344 |
|
345 |
|
346 |
|
347 |
|
348 |
|
349 |
|
350 |
|
351 | 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;
|
352 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
353 | var dateWithMonths = months || years ? _addMonths(_date, months + years * 12) : _date;
|
354 | var dateWithDays = days || weeks ? _addDays(dateWithMonths, days + weeks * 7) : dateWithMonths;
|
355 | var minutesToAdd = minutes + hours * 60;
|
356 | var secondsToAdd = seconds + minutesToAdd * 60;
|
357 | var msToAdd = secondsToAdd * 1000;
|
358 | return _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, +dateWithDays + msToAdd);
|
359 | }
|
360 |
|
361 | function _isSaturday(date, options) {
|
362 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDay() === 6;
|
363 | }
|
364 |
|
365 |
|
366 | function _isSunday(date, options) {
|
367 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDay() === 0;
|
368 | }
|
369 |
|
370 |
|
371 | function _isWeekend(date, options) {
|
372 | var day = _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDay();
|
373 | return day === 0 || day === 6;
|
374 | }
|
375 |
|
376 |
|
377 | function _addBusinessDays(date, amount, options) {
|
378 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
379 | var startedOnWeekend = _isWeekend(_date, options);
|
380 | if (isNaN(amount))
|
381 | return _constructFrom(options === null || options === void 0 ? void 0 : options.in, NaN);
|
382 | var hours = _date.getHours();
|
383 | var sign = amount < 0 ? -1 : 1;
|
384 | var fullWeeks = Math.trunc(amount / 5);
|
385 | _date.setDate(_date.getDate() + fullWeeks * 7);
|
386 | var restDays = Math.abs(amount % 5);
|
387 | while (restDays > 0) {
|
388 | _date.setDate(_date.getDate() + sign);
|
389 | if (!_isWeekend(_date, options))
|
390 | restDays -= 1;
|
391 | }
|
392 | if (startedOnWeekend && _isWeekend(_date, options) && amount !== 0) {
|
393 | if (_isSaturday(_date, options))
|
394 | _date.setDate(_date.getDate() + (sign < 0 ? 2 : -1));
|
395 | if (_isSunday(_date, options))
|
396 | _date.setDate(_date.getDate() + (sign < 0 ? 1 : -2));
|
397 | }
|
398 | _date.setHours(hours);
|
399 | return _date;
|
400 | }
|
401 |
|
402 | function _addMilliseconds(date, amount, options) {
|
403 | return _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, +_toDate(date) + amount);
|
404 | }
|
405 |
|
406 |
|
407 | function _addHours(date, amount, options) {
|
408 | return _addMilliseconds(date, amount * millisecondsInHour, options);
|
409 | }
|
410 |
|
411 | function getDefaultOptions() {
|
412 | return defaultOptions;
|
413 | }
|
414 | function setDefaultOptions(newOptions) {
|
415 | defaultOptions = newOptions;
|
416 | }
|
417 | var defaultOptions = {};
|
418 |
|
419 |
|
420 | function _startOfWeek(date, options) {var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _defaultOptions3$loca;
|
421 | var defaultOptions3 = getDefaultOptions();
|
422 | 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;
|
423 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
424 | var day = _date.getDay();
|
425 | var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
|
426 | _date.setDate(_date.getDate() - diff);
|
427 | _date.setHours(0, 0, 0, 0);
|
428 | return _date;
|
429 | }
|
430 |
|
431 |
|
432 | function _startOfISOWeek(date, options) {
|
433 | return _startOfWeek(date, _objectSpread(_objectSpread({}, options), {}, { weekStartsOn: 1 }));
|
434 | }
|
435 |
|
436 |
|
437 | function _getISOWeekYear(date, options) {
|
438 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
439 | var year = _date.getFullYear();
|
440 | var fourthOfJanuaryOfNextYear = _constructFrom(_date, 0);
|
441 | fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
442 | fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
443 | var startOfNextYear = _startOfISOWeek(fourthOfJanuaryOfNextYear);
|
444 | var fourthOfJanuaryOfThisYear = _constructFrom(_date, 0);
|
445 | fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
|
446 | fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
|
447 | var startOfThisYear = _startOfISOWeek(fourthOfJanuaryOfThisYear);
|
448 | if (_date.getTime() >= startOfNextYear.getTime()) {
|
449 | return year + 1;
|
450 | } else if (_date.getTime() >= startOfThisYear.getTime()) {
|
451 | return year;
|
452 | } else {
|
453 | return year - 1;
|
454 | }
|
455 | }
|
456 |
|
457 |
|
458 | function getTimezoneOffsetInMilliseconds(date) {
|
459 | var _date = _toDate(date);
|
460 | var utcDate = new Date(Date.UTC(_date.getFullYear(), _date.getMonth(), _date.getDate(), _date.getHours(), _date.getMinutes(), _date.getSeconds(), _date.getMilliseconds()));
|
461 | utcDate.setUTCFullYear(_date.getFullYear());
|
462 | return +date - +utcDate;
|
463 | }
|
464 |
|
465 |
|
466 | function normalizeDates(context) {for (var _len = arguments.length, dates = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {dates[_key - 1] = arguments[_key];}
|
467 | var normalize = _constructFrom.bind(null, context || dates.find(function (date) {return _typeof(date) === "object";}));
|
468 | return dates.map(normalize);
|
469 | }
|
470 |
|
471 |
|
472 | function _startOfDay(date, options) {
|
473 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
474 | _date.setHours(0, 0, 0, 0);
|
475 | return _date;
|
476 | }
|
477 |
|
478 |
|
479 | function _differenceInCalendarDays(laterDate, earlierDate, options) {
|
480 | var _normalizeDates = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates2 = _slicedToArray(_normalizeDates, 2),laterDate_ = _normalizeDates2[0],earlierDate_ = _normalizeDates2[1];
|
481 | var laterStartOfDay = _startOfDay(laterDate_);
|
482 | var earlierStartOfDay = _startOfDay(earlierDate_);
|
483 | var laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
|
484 | var earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
|
485 | return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
|
486 | }
|
487 |
|
488 |
|
489 | function _startOfISOWeekYear(date, options) {
|
490 | var year = _getISOWeekYear(date, options);
|
491 | var fourthOfJanuary = _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, 0);
|
492 | fourthOfJanuary.setFullYear(year, 0, 4);
|
493 | fourthOfJanuary.setHours(0, 0, 0, 0);
|
494 | return _startOfISOWeek(fourthOfJanuary);
|
495 | }
|
496 |
|
497 |
|
498 | function _setISOWeekYear(date, weekYear, options) {
|
499 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
500 | var diff = _differenceInCalendarDays(_date, _startOfISOWeekYear(_date, options));
|
501 | var fourthOfJanuary = _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, 0);
|
502 | fourthOfJanuary.setFullYear(weekYear, 0, 4);
|
503 | fourthOfJanuary.setHours(0, 0, 0, 0);
|
504 | _date = _startOfISOWeekYear(fourthOfJanuary);
|
505 | _date.setDate(_date.getDate() + diff);
|
506 | return _date;
|
507 | }
|
508 |
|
509 |
|
510 | function _addISOWeekYears(date, amount, options) {
|
511 | return _setISOWeekYear(date, _getISOWeekYear(date, options) + amount, options);
|
512 | }
|
513 |
|
514 | function _addMinutes(date, amount, options) {
|
515 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
516 | _date.setTime(_date.getTime() + amount * millisecondsInMinute);
|
517 | return _date;
|
518 | }
|
519 |
|
520 | function _addQuarters(date, amount, options) {
|
521 | return _addMonths(date, amount * 3, options);
|
522 | }
|
523 |
|
524 | function _addSeconds(date, amount, options) {
|
525 | return _addMilliseconds(date, amount * 1000, options);
|
526 | }
|
527 |
|
528 | function _addWeeks(date, amount, options) {
|
529 | return _addDays(date, amount * 7, options);
|
530 | }
|
531 |
|
532 | function _addYears(date, amount, options) {
|
533 | return _addMonths(date, amount * 12, options);
|
534 | }
|
535 |
|
536 | function _areIntervalsOverlapping(intervalLeft, intervalRight, options) {
|
537 | var _sort = [
|
538 | +_toDate(intervalLeft.start, options === null || options === void 0 ? void 0 : options.in),
|
539 | +_toDate(intervalLeft.end, options === null || options === void 0 ? void 0 : options.in)].
|
540 | sort(function (a, b) {return a - b;}),_sort2 = _slicedToArray(_sort, 2),leftStartTime = _sort2[0],leftEndTime = _sort2[1];
|
541 | var _sort3 = [
|
542 | +_toDate(intervalRight.start, options === null || options === void 0 ? void 0 : options.in),
|
543 | +_toDate(intervalRight.end, options === null || options === void 0 ? void 0 : options.in)].
|
544 | sort(function (a, b) {return a - b;}),_sort4 = _slicedToArray(_sort3, 2),rightStartTime = _sort4[0],rightEndTime = _sort4[1];
|
545 | if (options !== null && options !== void 0 && options.inclusive)
|
546 | return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime;
|
547 | return leftStartTime < rightEndTime && rightStartTime < leftEndTime;
|
548 | }
|
549 |
|
550 | function _max(dates, options) {
|
551 | var result;
|
552 | var context = options === null || options === void 0 ? void 0 : options.in;
|
553 | dates.forEach(function (date) {
|
554 | if (!context && _typeof(date) === "object")
|
555 | context = _constructFrom.bind(null, date);
|
556 | var date_ = _toDate(date, context);
|
557 | if (!result || result < date_ || isNaN(+date_))
|
558 | result = date_;
|
559 | });
|
560 | return _constructFrom(context, result || NaN);
|
561 | }
|
562 |
|
563 |
|
564 | function _min(dates, options) {
|
565 | var result;
|
566 | var context = options === null || options === void 0 ? void 0 : options.in;
|
567 | dates.forEach(function (date) {
|
568 | if (!context && _typeof(date) === "object")
|
569 | context = _constructFrom.bind(null, date);
|
570 | var date_ = _toDate(date, context);
|
571 | if (!result || result > date_ || isNaN(+date_))
|
572 | result = date_;
|
573 | });
|
574 | return _constructFrom(context, result || NaN);
|
575 | }
|
576 |
|
577 |
|
578 | function _clamp(date, interval, options) {
|
579 | var _normalizeDates3 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, date, interval.start, interval.end),_normalizeDates4 = _slicedToArray(_normalizeDates3, 3),date_ = _normalizeDates4[0],start = _normalizeDates4[1],end = _normalizeDates4[2];
|
580 | return _min([_max([date_, start], options), end], options);
|
581 | }
|
582 |
|
583 | function _closestIndexTo(dateToCompare, dates) {
|
584 | var timeToCompare = +_toDate(dateToCompare);
|
585 | if (isNaN(timeToCompare))
|
586 | return NaN;
|
587 | var result;
|
588 | var minDistance;
|
589 | dates.forEach(function (date, index) {
|
590 | var date_ = _toDate(date);
|
591 | if (isNaN(+date_)) {
|
592 | result = NaN;
|
593 | minDistance = NaN;
|
594 | return;
|
595 | }
|
596 | var distance = Math.abs(timeToCompare - +date_);
|
597 | if (result == null || distance < minDistance) {
|
598 | result = index;
|
599 | minDistance = distance;
|
600 | }
|
601 | });
|
602 | return result;
|
603 | }
|
604 |
|
605 | function _closestTo(dateToCompare, dates, options) {
|
606 | var _normalizeDates5 = normalizeDates.apply(void 0, [options === null || options === void 0 ? void 0 : options.in, dateToCompare].concat(_toConsumableArray(dates))),_normalizeDates6 = _toArray(_normalizeDates5),dateToCompare_ = _normalizeDates6[0],dates_ = _normalizeDates6.slice(1);
|
607 | var index = _closestIndexTo(dateToCompare_, dates_);
|
608 | if (typeof index === "number" && isNaN(index))
|
609 | return _constructFrom(dateToCompare_, NaN);
|
610 | if (index !== undefined)
|
611 | return dates_[index];
|
612 | }
|
613 |
|
614 | function _compareAsc(dateLeft, dateRight) {
|
615 | var diff = +_toDate(dateLeft) - +_toDate(dateRight);
|
616 | if (diff < 0)
|
617 | return -1;else
|
618 | if (diff > 0)
|
619 | return 1;
|
620 | return diff;
|
621 | }
|
622 |
|
623 | function _compareDesc(dateLeft, dateRight) {
|
624 | var diff = +_toDate(dateLeft) - +_toDate(dateRight);
|
625 | if (diff > 0)
|
626 | return -1;else
|
627 | if (diff < 0)
|
628 | return 1;
|
629 | return diff;
|
630 | }
|
631 |
|
632 | function _constructNow(date) {
|
633 | return _constructFrom(date, Date.now());
|
634 | }
|
635 |
|
636 | function _daysToWeeks(days) {
|
637 | var result = Math.trunc(days / daysInWeek);
|
638 | return result === 0 ? 0 : result;
|
639 | }
|
640 |
|
641 | function _isSameDay(laterDate, earlierDate, options) {
|
642 | var _normalizeDates7 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates8 = _slicedToArray(_normalizeDates7, 2),dateLeft_ = _normalizeDates8[0],dateRight_ = _normalizeDates8[1];
|
643 | return +_startOfDay(dateLeft_) === +_startOfDay(dateRight_);
|
644 | }
|
645 |
|
646 |
|
647 | function _isDate(value) {
|
648 | return value instanceof Date || _typeof(value) === "object" && Object.prototype.toString.call(value) === "[object Date]";
|
649 | }
|
650 |
|
651 |
|
652 | function _isValid(date) {
|
653 | return !(!_isDate(date) && typeof date !== "number" || isNaN(+_toDate(date)));
|
654 | }
|
655 |
|
656 |
|
657 | function _differenceInBusinessDays(laterDate, earlierDate, options) {
|
658 | var _normalizeDates9 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates10 = _slicedToArray(_normalizeDates9, 2),laterDate_ = _normalizeDates10[0],earlierDate_ = _normalizeDates10[1];
|
659 | if (!_isValid(laterDate_) || !_isValid(earlierDate_))
|
660 | return NaN;
|
661 | var diff = _differenceInCalendarDays(laterDate_, earlierDate_);
|
662 | var sign = diff < 0 ? -1 : 1;
|
663 | var weeks = Math.trunc(diff / 7);
|
664 | var result = weeks * 5;
|
665 | var movingDate = _addDays(earlierDate_, weeks * 7);
|
666 | while (!_isSameDay(laterDate_, movingDate)) {
|
667 | result += _isWeekend(movingDate, options) ? 0 : sign;
|
668 | movingDate = _addDays(movingDate, sign);
|
669 | }
|
670 | return result === 0 ? 0 : result;
|
671 | }
|
672 |
|
673 | function _differenceInCalendarISOWeekYears(laterDate, earlierDate, options) {
|
674 | var _normalizeDates11 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates12 = _slicedToArray(_normalizeDates11, 2),laterDate_ = _normalizeDates12[0],earlierDate_ = _normalizeDates12[1];
|
675 | return _getISOWeekYear(laterDate_, options) - _getISOWeekYear(earlierDate_, options);
|
676 | }
|
677 |
|
678 | function _differenceInCalendarISOWeeks(laterDate, earlierDate, options) {
|
679 | var _normalizeDates13 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates14 = _slicedToArray(_normalizeDates13, 2),laterDate_ = _normalizeDates14[0],earlierDate_ = _normalizeDates14[1];
|
680 | var startOfISOWeekLeft = _startOfISOWeek(laterDate_);
|
681 | var startOfISOWeekRight = _startOfISOWeek(earlierDate_);
|
682 | var timestampLeft = +startOfISOWeekLeft - getTimezoneOffsetInMilliseconds(startOfISOWeekLeft);
|
683 | var timestampRight = +startOfISOWeekRight - getTimezoneOffsetInMilliseconds(startOfISOWeekRight);
|
684 | return Math.round((timestampLeft - timestampRight) / millisecondsInWeek);
|
685 | }
|
686 |
|
687 | function _differenceInCalendarMonths(laterDate, earlierDate, options) {
|
688 | var _normalizeDates15 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates16 = _slicedToArray(_normalizeDates15, 2),laterDate_ = _normalizeDates16[0],earlierDate_ = _normalizeDates16[1];
|
689 | var yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
|
690 | var monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth();
|
691 | return yearsDiff * 12 + monthsDiff;
|
692 | }
|
693 |
|
694 | function _getQuarter(date, options) {
|
695 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
696 | var quarter = Math.trunc(_date.getMonth() / 3) + 1;
|
697 | return quarter;
|
698 | }
|
699 |
|
700 |
|
701 | function _differenceInCalendarQuarters(laterDate, earlierDate, options) {
|
702 | var _normalizeDates17 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates18 = _slicedToArray(_normalizeDates17, 2),laterDate_ = _normalizeDates18[0],earlierDate_ = _normalizeDates18[1];
|
703 | var yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear();
|
704 | var quartersDiff = _getQuarter(laterDate_) - _getQuarter(earlierDate_);
|
705 | return yearsDiff * 4 + quartersDiff;
|
706 | }
|
707 |
|
708 | function _differenceInCalendarWeeks(laterDate, earlierDate, options) {
|
709 | var _normalizeDates19 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates20 = _slicedToArray(_normalizeDates19, 2),laterDate_ = _normalizeDates20[0],earlierDate_ = _normalizeDates20[1];
|
710 | var laterStartOfWeek = _startOfWeek(laterDate_, options);
|
711 | var earlierStartOfWeek = _startOfWeek(earlierDate_, options);
|
712 | var laterTimestamp = +laterStartOfWeek - getTimezoneOffsetInMilliseconds(laterStartOfWeek);
|
713 | var earlierTimestamp = +earlierStartOfWeek - getTimezoneOffsetInMilliseconds(earlierStartOfWeek);
|
714 | return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInWeek);
|
715 | }
|
716 |
|
717 | function _differenceInCalendarYears(laterDate, earlierDate, options) {
|
718 | var _normalizeDates21 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates22 = _slicedToArray(_normalizeDates21, 2),laterDate_ = _normalizeDates22[0],earlierDate_ = _normalizeDates22[1];
|
719 | return laterDate_.getFullYear() - earlierDate_.getFullYear();
|
720 | }
|
721 |
|
722 | function _differenceInDays(laterDate, earlierDate, options) {
|
723 | var _normalizeDates23 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates24 = _slicedToArray(_normalizeDates23, 2),laterDate_ = _normalizeDates24[0],earlierDate_ = _normalizeDates24[1];
|
724 | var sign = compareLocalAsc(laterDate_, earlierDate_);
|
725 | var difference = Math.abs(_differenceInCalendarDays(laterDate_, earlierDate_));
|
726 | laterDate_.setDate(laterDate_.getDate() - sign * difference);
|
727 | var isLastDayNotFull = Number(compareLocalAsc(laterDate_, earlierDate_) === -sign);
|
728 | var result = sign * (difference - isLastDayNotFull);
|
729 | return result === 0 ? 0 : result;
|
730 | }
|
731 | function compareLocalAsc(laterDate, earlierDate) {
|
732 | var diff = laterDate.getFullYear() - earlierDate.getFullYear() || laterDate.getMonth() - earlierDate.getMonth() || laterDate.getDate() - earlierDate.getDate() || laterDate.getHours() - earlierDate.getHours() || laterDate.getMinutes() - earlierDate.getMinutes() || laterDate.getSeconds() - earlierDate.getSeconds() || laterDate.getMilliseconds() - earlierDate.getMilliseconds();
|
733 | if (diff < 0)
|
734 | return -1;
|
735 | if (diff > 0)
|
736 | return 1;
|
737 | return diff;
|
738 | }
|
739 |
|
740 | function getRoundingMethod(method) {
|
741 | return function (number) {
|
742 | var round = method ? Math[method] : Math.trunc;
|
743 | var result = round(number);
|
744 | return result === 0 ? 0 : result;
|
745 | };
|
746 | }
|
747 |
|
748 |
|
749 | function _differenceInHours(laterDate, earlierDate, options) {
|
750 | var _normalizeDates25 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates26 = _slicedToArray(_normalizeDates25, 2),laterDate_ = _normalizeDates26[0],earlierDate_ = _normalizeDates26[1];
|
751 | var diff = (+laterDate_ - +earlierDate_) / millisecondsInHour;
|
752 | return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
|
753 | }
|
754 |
|
755 | function _subISOWeekYears(date, amount, options) {
|
756 | return _addISOWeekYears(date, -amount, options);
|
757 | }
|
758 |
|
759 |
|
760 | function _differenceInISOWeekYears(laterDate, earlierDate, options) {
|
761 | var _normalizeDates27 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates28 = _slicedToArray(_normalizeDates27, 2),laterDate_ = _normalizeDates28[0],earlierDate_ = _normalizeDates28[1];
|
762 | var sign = _compareAsc(laterDate_, earlierDate_);
|
763 | var diff = Math.abs(_differenceInCalendarISOWeekYears(laterDate_, earlierDate_, options));
|
764 | var adjustedDate = _subISOWeekYears(laterDate_, sign * diff, options);
|
765 | var isLastISOWeekYearNotFull = Number(_compareAsc(adjustedDate, earlierDate_) === -sign);
|
766 | var result = sign * (diff - isLastISOWeekYearNotFull);
|
767 | return result === 0 ? 0 : result;
|
768 | }
|
769 |
|
770 | function _differenceInMilliseconds(laterDate, earlierDate) {
|
771 | return +_toDate(laterDate) - +_toDate(earlierDate);
|
772 | }
|
773 |
|
774 | function _differenceInMinutes(dateLeft, dateRight, options) {
|
775 | var diff = _differenceInMilliseconds(dateLeft, dateRight) / millisecondsInMinute;
|
776 | return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
|
777 | }
|
778 |
|
779 | function _endOfDay(date, options) {
|
780 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
781 | _date.setHours(23, 59, 59, 999);
|
782 | return _date;
|
783 | }
|
784 |
|
785 |
|
786 | function _endOfMonth(date, options) {
|
787 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
788 | var month = _date.getMonth();
|
789 | _date.setFullYear(_date.getFullYear(), month + 1, 0);
|
790 | _date.setHours(23, 59, 59, 999);
|
791 | return _date;
|
792 | }
|
793 |
|
794 |
|
795 | function _isLastDayOfMonth(date, options) {
|
796 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
797 | return +_endOfDay(_date, options) === +_endOfMonth(_date, options);
|
798 | }
|
799 |
|
800 |
|
801 | function _differenceInMonths(laterDate, earlierDate, options) {
|
802 | var _normalizeDates29 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, laterDate, earlierDate),_normalizeDates30 = _slicedToArray(_normalizeDates29, 3),laterDate_ = _normalizeDates30[0],workingLaterDate = _normalizeDates30[1],earlierDate_ = _normalizeDates30[2];
|
803 | var sign = _compareAsc(workingLaterDate, earlierDate_);
|
804 | var difference = Math.abs(_differenceInCalendarMonths(workingLaterDate, earlierDate_));
|
805 | if (difference < 1)
|
806 | return 0;
|
807 | if (workingLaterDate.getMonth() === 1 && workingLaterDate.getDate() > 27)
|
808 | workingLaterDate.setDate(30);
|
809 | workingLaterDate.setMonth(workingLaterDate.getMonth() - sign * difference);
|
810 | var isLastMonthNotFull = _compareAsc(workingLaterDate, earlierDate_) === -sign;
|
811 | if (_isLastDayOfMonth(laterDate_) && difference === 1 && _compareAsc(laterDate_, earlierDate_) === 1) {
|
812 | isLastMonthNotFull = false;
|
813 | }
|
814 | var result = sign * (difference - +isLastMonthNotFull);
|
815 | return result === 0 ? 0 : result;
|
816 | }
|
817 |
|
818 | function _differenceInQuarters(laterDate, earlierDate, options) {
|
819 | var diff = _differenceInMonths(laterDate, earlierDate, options) / 3;
|
820 | return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
|
821 | }
|
822 |
|
823 | function _differenceInSeconds(laterDate, earlierDate, options) {
|
824 | var diff = _differenceInMilliseconds(laterDate, earlierDate) / 1000;
|
825 | return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
|
826 | }
|
827 |
|
828 | function _differenceInWeeks(laterDate, earlierDate, options) {
|
829 | var diff = _differenceInDays(laterDate, earlierDate, options) / 7;
|
830 | return getRoundingMethod(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff);
|
831 | }
|
832 |
|
833 | function _differenceInYears(laterDate, earlierDate, options) {
|
834 | var _normalizeDates31 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates32 = _slicedToArray(_normalizeDates31, 2),laterDate_ = _normalizeDates32[0],earlierDate_ = _normalizeDates32[1];
|
835 | var sign = _compareAsc(laterDate_, earlierDate_);
|
836 | var diff = Math.abs(_differenceInCalendarYears(laterDate_, earlierDate_));
|
837 | laterDate_.setFullYear(1584);
|
838 | earlierDate_.setFullYear(1584);
|
839 | var partial = _compareAsc(laterDate_, earlierDate_) === -sign;
|
840 | var result = sign * (diff - +partial);
|
841 | return result === 0 ? 0 : result;
|
842 | }
|
843 |
|
844 | function normalizeInterval(context, interval) {
|
845 | var _normalizeDates33 = normalizeDates(context, interval.start, interval.end),_normalizeDates34 = _slicedToArray(_normalizeDates33, 2),start = _normalizeDates34[0],end = _normalizeDates34[1];
|
846 | return { start: start, end: end };
|
847 | }
|
848 |
|
849 |
|
850 | function _eachDayOfInterval(interval, options) {var _options$step;
|
851 | var _normalizeInterval = normalizeInterval(options === null || options === void 0 ? void 0 : options.in, interval),start = _normalizeInterval.start,end = _normalizeInterval.end;
|
852 | var reversed = +start > +end;
|
853 | var endTime = reversed ? +start : +end;
|
854 | var date = reversed ? end : start;
|
855 | date.setHours(0, 0, 0, 0);
|
856 | var step = (_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1;
|
857 | if (!step)
|
858 | return [];
|
859 | if (step < 0) {
|
860 | step = -step;
|
861 | reversed = !reversed;
|
862 | }
|
863 | var dates = [];
|
864 | while (+date <= endTime) {
|
865 | dates.push(_constructFrom(start, date));
|
866 | date.setDate(date.getDate() + step);
|
867 | date.setHours(0, 0, 0, 0);
|
868 | }
|
869 | return reversed ? dates.reverse() : dates;
|
870 | }
|
871 |
|
872 | function _eachHourOfInterval(interval, options) {var _options$step2;
|
873 | var _normalizeInterval2 = normalizeInterval(options === null || options === void 0 ? void 0 : options.in, interval),start = _normalizeInterval2.start,end = _normalizeInterval2.end;
|
874 | var reversed = +start > +end;
|
875 | var endTime = reversed ? +start : +end;
|
876 | var date = reversed ? end : start;
|
877 | date.setMinutes(0, 0, 0);
|
878 | var step = (_options$step2 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step2 !== void 0 ? _options$step2 : 1;
|
879 | if (!step)
|
880 | return [];
|
881 | if (step < 0) {
|
882 | step = -step;
|
883 | reversed = !reversed;
|
884 | }
|
885 | var dates = [];
|
886 | while (+date <= endTime) {
|
887 | dates.push(_constructFrom(start, date));
|
888 | date.setHours(date.getHours() + step);
|
889 | }
|
890 | return reversed ? dates.reverse() : dates;
|
891 | }
|
892 |
|
893 | function _eachMinuteOfInterval(interval, options) {var _options$step3;
|
894 | var _normalizeInterval3 = normalizeInterval(options === null || options === void 0 ? void 0 : options.in, interval),start = _normalizeInterval3.start,end = _normalizeInterval3.end;
|
895 | start.setSeconds(0, 0);
|
896 | var reversed = +start > +end;
|
897 | var endTime = reversed ? +start : +end;
|
898 | var date = reversed ? end : start;
|
899 | var step = (_options$step3 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step3 !== void 0 ? _options$step3 : 1;
|
900 | if (!step)
|
901 | return [];
|
902 | if (step < 0) {
|
903 | step = -step;
|
904 | reversed = !reversed;
|
905 | }
|
906 | var dates = [];
|
907 | while (+date <= endTime) {
|
908 | dates.push(_constructFrom(start, date));
|
909 | date = _addMinutes(date, step);
|
910 | }
|
911 | return reversed ? dates.reverse() : dates;
|
912 | }
|
913 |
|
914 | function _eachMonthOfInterval(interval, options) {var _options$step4;
|
915 | var _normalizeInterval4 = normalizeInterval(options === null || options === void 0 ? void 0 : options.in, interval),start = _normalizeInterval4.start,end = _normalizeInterval4.end;
|
916 | var reversed = +start > +end;
|
917 | var endTime = reversed ? +start : +end;
|
918 | var date = reversed ? end : start;
|
919 | date.setHours(0, 0, 0, 0);
|
920 | date.setDate(1);
|
921 | var step = (_options$step4 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step4 !== void 0 ? _options$step4 : 1;
|
922 | if (!step)
|
923 | return [];
|
924 | if (step < 0) {
|
925 | step = -step;
|
926 | reversed = !reversed;
|
927 | }
|
928 | var dates = [];
|
929 | while (+date <= endTime) {
|
930 | dates.push(_constructFrom(start, date));
|
931 | date.setMonth(date.getMonth() + step);
|
932 | }
|
933 | return reversed ? dates.reverse() : dates;
|
934 | }
|
935 |
|
936 | function _startOfQuarter(date, options) {
|
937 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
938 | var currentMonth = _date.getMonth();
|
939 | var month = currentMonth - currentMonth % 3;
|
940 | _date.setMonth(month, 1);
|
941 | _date.setHours(0, 0, 0, 0);
|
942 | return _date;
|
943 | }
|
944 |
|
945 |
|
946 | function _eachQuarterOfInterval(interval, options) {var _options$step5;
|
947 | var _normalizeInterval5 = normalizeInterval(options === null || options === void 0 ? void 0 : options.in, interval),start = _normalizeInterval5.start,end = _normalizeInterval5.end;
|
948 | var reversed = +start > +end;
|
949 | var endTime = reversed ? +_startOfQuarter(start) : +_startOfQuarter(end);
|
950 | var date = reversed ? _startOfQuarter(end) : _startOfQuarter(start);
|
951 | var step = (_options$step5 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step5 !== void 0 ? _options$step5 : 1;
|
952 | if (!step)
|
953 | return [];
|
954 | if (step < 0) {
|
955 | step = -step;
|
956 | reversed = !reversed;
|
957 | }
|
958 | var dates = [];
|
959 | while (+date <= endTime) {
|
960 | dates.push(_constructFrom(start, date));
|
961 | date = _addQuarters(date, step);
|
962 | }
|
963 | return reversed ? dates.reverse() : dates;
|
964 | }
|
965 |
|
966 | function _eachWeekOfInterval(interval, options) {var _options$step6;
|
967 | var _normalizeInterval6 = normalizeInterval(options === null || options === void 0 ? void 0 : options.in, interval),start = _normalizeInterval6.start,end = _normalizeInterval6.end;
|
968 | var reversed = +start > +end;
|
969 | var startDateWeek = reversed ? _startOfWeek(end, options) : _startOfWeek(start, options);
|
970 | var endDateWeek = reversed ? _startOfWeek(start, options) : _startOfWeek(end, options);
|
971 | startDateWeek.setHours(15);
|
972 | endDateWeek.setHours(15);
|
973 | var endTime = +endDateWeek.getTime();
|
974 | var currentDate = startDateWeek;
|
975 | var step = (_options$step6 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step6 !== void 0 ? _options$step6 : 1;
|
976 | if (!step)
|
977 | return [];
|
978 | if (step < 0) {
|
979 | step = -step;
|
980 | reversed = !reversed;
|
981 | }
|
982 | var dates = [];
|
983 | while (+currentDate <= endTime) {
|
984 | currentDate.setHours(0);
|
985 | dates.push(_constructFrom(start, currentDate));
|
986 | currentDate = _addWeeks(currentDate, step);
|
987 | currentDate.setHours(15);
|
988 | }
|
989 | return reversed ? dates.reverse() : dates;
|
990 | }
|
991 |
|
992 | function _eachWeekendOfInterval(interval, options) {
|
993 | var _normalizeInterval7 = normalizeInterval(options === null || options === void 0 ? void 0 : options.in, interval),start = _normalizeInterval7.start,end = _normalizeInterval7.end;
|
994 | var dateInterval = _eachDayOfInterval({ start: start, end: end }, options);
|
995 | var weekends = [];
|
996 | var index = 0;
|
997 | while (index < dateInterval.length) {
|
998 | var date = dateInterval[index++];
|
999 | if (_isWeekend(date))
|
1000 | weekends.push(_constructFrom(start, date));
|
1001 | }
|
1002 | return weekends;
|
1003 | }
|
1004 |
|
1005 | function _startOfMonth(date, options) {
|
1006 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1007 | _date.setDate(1);
|
1008 | _date.setHours(0, 0, 0, 0);
|
1009 | return _date;
|
1010 | }
|
1011 |
|
1012 |
|
1013 | function _eachWeekendOfMonth(date, options) {
|
1014 | var start = _startOfMonth(date, options);
|
1015 | var end = _endOfMonth(date, options);
|
1016 | return _eachWeekendOfInterval({ start: start, end: end }, options);
|
1017 | }
|
1018 |
|
1019 | function _endOfYear(date, options) {
|
1020 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1021 | var year = _date.getFullYear();
|
1022 | _date.setFullYear(year + 1, 0, 0);
|
1023 | _date.setHours(23, 59, 59, 999);
|
1024 | return _date;
|
1025 | }
|
1026 |
|
1027 |
|
1028 | function _startOfYear(date, options) {
|
1029 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1030 | date_.setFullYear(date_.getFullYear(), 0, 1);
|
1031 | date_.setHours(0, 0, 0, 0);
|
1032 | return date_;
|
1033 | }
|
1034 |
|
1035 |
|
1036 | function _eachWeekendOfYear(date, options) {
|
1037 | var start = _startOfYear(date, options);
|
1038 | var end = _endOfYear(date, options);
|
1039 | return _eachWeekendOfInterval({ start: start, end: end }, options);
|
1040 | }
|
1041 |
|
1042 | function _eachYearOfInterval(interval, options) {var _options$step7;
|
1043 | var _normalizeInterval8 = normalizeInterval(options === null || options === void 0 ? void 0 : options.in, interval),start = _normalizeInterval8.start,end = _normalizeInterval8.end;
|
1044 | var reversed = +start > +end;
|
1045 | var endTime = reversed ? +start : +end;
|
1046 | var date = reversed ? end : start;
|
1047 | date.setHours(0, 0, 0, 0);
|
1048 | date.setMonth(0, 1);
|
1049 | var step = (_options$step7 = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step7 !== void 0 ? _options$step7 : 1;
|
1050 | if (!step)
|
1051 | return [];
|
1052 | if (step < 0) {
|
1053 | step = -step;
|
1054 | reversed = !reversed;
|
1055 | }
|
1056 | var dates = [];
|
1057 | while (+date <= endTime) {
|
1058 | dates.push(_constructFrom(start, date));
|
1059 | date.setFullYear(date.getFullYear() + step);
|
1060 | }
|
1061 | return reversed ? dates.reverse() : dates;
|
1062 | }
|
1063 |
|
1064 | function _endOfDecade(date, options) {
|
1065 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1066 | var year = _date.getFullYear();
|
1067 | var decade = 9 + Math.floor(year / 10) * 10;
|
1068 | _date.setFullYear(decade, 11, 31);
|
1069 | _date.setHours(23, 59, 59, 999);
|
1070 | return _date;
|
1071 | }
|
1072 |
|
1073 | function _endOfHour(date, options) {
|
1074 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1075 | _date.setMinutes(59, 59, 999);
|
1076 | return _date;
|
1077 | }
|
1078 |
|
1079 | function _endOfWeek(date, options) {var _ref4, _ref5, _ref6, _options$weekStartsOn2, _options$locale2, _defaultOptions4$loca;
|
1080 | var defaultOptions4 = getDefaultOptions();
|
1081 | var weekStartsOn = (_ref4 = (_ref5 = (_ref6 = (_options$weekStartsOn2 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn2 !== void 0 ? _options$weekStartsOn2 : options === null || options === void 0 || (_options$locale2 = options.locale) === null || _options$locale2 === void 0 || (_options$locale2 = _options$locale2.options) === null || _options$locale2 === void 0 ? void 0 : _options$locale2.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : defaultOptions4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : (_defaultOptions4$loca = defaultOptions4.locale) === null || _defaultOptions4$loca === void 0 || (_defaultOptions4$loca = _defaultOptions4$loca.options) === null || _defaultOptions4$loca === void 0 ? void 0 : _defaultOptions4$loca.weekStartsOn) !== null && _ref4 !== void 0 ? _ref4 : 0;
|
1082 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1083 | var day = _date.getDay();
|
1084 | var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
|
1085 | _date.setDate(_date.getDate() + diff);
|
1086 | _date.setHours(23, 59, 59, 999);
|
1087 | return _date;
|
1088 | }
|
1089 |
|
1090 |
|
1091 | function _endOfISOWeek(date, options) {
|
1092 | return _endOfWeek(date, _objectSpread(_objectSpread({}, options), {}, { weekStartsOn: 1 }));
|
1093 | }
|
1094 |
|
1095 | function _endOfISOWeekYear(date, options) {
|
1096 | var year = _getISOWeekYear(date, options);
|
1097 | var fourthOfJanuaryOfNextYear = _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, 0);
|
1098 | fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
1099 | fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
1100 | var _date = _startOfISOWeek(fourthOfJanuaryOfNextYear, options);
|
1101 | _date.setMilliseconds(_date.getMilliseconds() - 1);
|
1102 | return _date;
|
1103 | }
|
1104 |
|
1105 | function _endOfMinute(date, options) {
|
1106 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1107 | _date.setSeconds(59, 999);
|
1108 | return _date;
|
1109 | }
|
1110 |
|
1111 | function _endOfQuarter(date, options) {
|
1112 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1113 | var currentMonth = _date.getMonth();
|
1114 | var month = currentMonth - currentMonth % 3 + 3;
|
1115 | _date.setMonth(month, 0);
|
1116 | _date.setHours(23, 59, 59, 999);
|
1117 | return _date;
|
1118 | }
|
1119 |
|
1120 | function _endOfSecond(date, options) {
|
1121 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1122 | _date.setMilliseconds(999);
|
1123 | return _date;
|
1124 | }
|
1125 |
|
1126 | function _endOfToday(options) {
|
1127 | return _endOfDay(Date.now(), options);
|
1128 | }
|
1129 |
|
1130 | function _endOfTomorrow(options) {
|
1131 | var now = _constructNow(options === null || options === void 0 ? void 0 : options.in);
|
1132 | var year = now.getFullYear();
|
1133 | var month = now.getMonth();
|
1134 | var day = now.getDate();
|
1135 | var date = _constructNow(options === null || options === void 0 ? void 0 : options.in);
|
1136 | date.setFullYear(year, month, day + 1);
|
1137 | date.setHours(23, 59, 59, 999);
|
1138 | return options !== null && options !== void 0 && options.in ? options.in(date) : date;
|
1139 | }
|
1140 |
|
1141 | function _endOfYesterday(options) {
|
1142 | var now = _constructNow(options === null || options === void 0 ? void 0 : options.in);
|
1143 | var date = _constructFrom(options === null || options === void 0 ? void 0 : options.in, 0);
|
1144 | date.setFullYear(now.getFullYear(), now.getMonth(), now.getDate() - 1);
|
1145 | date.setHours(23, 59, 59, 999);
|
1146 | return date;
|
1147 | }
|
1148 |
|
1149 | var formatDistanceLocale = {
|
1150 | lessThanXSeconds: {
|
1151 | one: "less than a second",
|
1152 | other: "less than {{count}} seconds"
|
1153 | },
|
1154 | xSeconds: {
|
1155 | one: "1 second",
|
1156 | other: "{{count}} seconds"
|
1157 | },
|
1158 | halfAMinute: "half a minute",
|
1159 | lessThanXMinutes: {
|
1160 | one: "less than a minute",
|
1161 | other: "less than {{count}} minutes"
|
1162 | },
|
1163 | xMinutes: {
|
1164 | one: "1 minute",
|
1165 | other: "{{count}} minutes"
|
1166 | },
|
1167 | aboutXHours: {
|
1168 | one: "about 1 hour",
|
1169 | other: "about {{count}} hours"
|
1170 | },
|
1171 | xHours: {
|
1172 | one: "1 hour",
|
1173 | other: "{{count}} hours"
|
1174 | },
|
1175 | xDays: {
|
1176 | one: "1 day",
|
1177 | other: "{{count}} days"
|
1178 | },
|
1179 | aboutXWeeks: {
|
1180 | one: "about 1 week",
|
1181 | other: "about {{count}} weeks"
|
1182 | },
|
1183 | xWeeks: {
|
1184 | one: "1 week",
|
1185 | other: "{{count}} weeks"
|
1186 | },
|
1187 | aboutXMonths: {
|
1188 | one: "about 1 month",
|
1189 | other: "about {{count}} months"
|
1190 | },
|
1191 | xMonths: {
|
1192 | one: "1 month",
|
1193 | other: "{{count}} months"
|
1194 | },
|
1195 | aboutXYears: {
|
1196 | one: "about 1 year",
|
1197 | other: "about {{count}} years"
|
1198 | },
|
1199 | xYears: {
|
1200 | one: "1 year",
|
1201 | other: "{{count}} years"
|
1202 | },
|
1203 | overXYears: {
|
1204 | one: "over 1 year",
|
1205 | other: "over {{count}} years"
|
1206 | },
|
1207 | almostXYears: {
|
1208 | one: "almost 1 year",
|
1209 | other: "almost {{count}} years"
|
1210 | }
|
1211 | };
|
1212 | var formatDistance = function formatDistance(token, count, options) {
|
1213 | var result;
|
1214 | var tokenValue = formatDistanceLocale[token];
|
1215 | if (typeof tokenValue === "string") {
|
1216 | result = tokenValue;
|
1217 | } else if (count === 1) {
|
1218 | result = tokenValue.one;
|
1219 | } else {
|
1220 | result = tokenValue.other.replace("{{count}}", count.toString());
|
1221 | }
|
1222 | if (options !== null && options !== void 0 && options.addSuffix) {
|
1223 | if (options.comparison && options.comparison > 0) {
|
1224 | return "in " + result;
|
1225 | } else {
|
1226 | return result + " ago";
|
1227 | }
|
1228 | }
|
1229 | return result;
|
1230 | };
|
1231 |
|
1232 |
|
1233 | function buildFormatLongFn(args) {
|
1234 | return function () {var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
1235 | var width = options.width ? String(options.width) : args.defaultWidth;
|
1236 | var format = args.formats[width] || args.formats[args.defaultWidth];
|
1237 | return format;
|
1238 | };
|
1239 | }
|
1240 |
|
1241 |
|
1242 | var dateFormats = {
|
1243 | full: "EEEE, MMMM do, y",
|
1244 | long: "MMMM do, y",
|
1245 | medium: "MMM d, y",
|
1246 | short: "MM/dd/yyyy"
|
1247 | };
|
1248 | var timeFormats = {
|
1249 | full: "h:mm:ss a zzzz",
|
1250 | long: "h:mm:ss a z",
|
1251 | medium: "h:mm:ss a",
|
1252 | short: "h:mm a"
|
1253 | };
|
1254 | var dateTimeFormats = {
|
1255 | full: "{{date}} 'at' {{time}}",
|
1256 | long: "{{date}} 'at' {{time}}",
|
1257 | medium: "{{date}}, {{time}}",
|
1258 | short: "{{date}}, {{time}}"
|
1259 | };
|
1260 | var formatLong = {
|
1261 | date: buildFormatLongFn({
|
1262 | formats: dateFormats,
|
1263 | defaultWidth: "full"
|
1264 | }),
|
1265 | time: buildFormatLongFn({
|
1266 | formats: timeFormats,
|
1267 | defaultWidth: "full"
|
1268 | }),
|
1269 | dateTime: buildFormatLongFn({
|
1270 | formats: dateTimeFormats,
|
1271 | defaultWidth: "full"
|
1272 | })
|
1273 | };
|
1274 |
|
1275 |
|
1276 | var formatRelativeLocale = {
|
1277 | lastWeek: "'last' eeee 'at' p",
|
1278 | yesterday: "'yesterday at' p",
|
1279 | today: "'today at' p",
|
1280 | tomorrow: "'tomorrow at' p",
|
1281 | nextWeek: "eeee 'at' p",
|
1282 | other: "P"
|
1283 | };
|
1284 | var formatRelative = function formatRelative(token, _date, _baseDate, _options) {return formatRelativeLocale[token];};
|
1285 |
|
1286 |
|
1287 | function buildLocalizeFn(args) {
|
1288 | return function (value, options) {
|
1289 | var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
|
1290 | var valuesArray;
|
1291 | if (context === "formatting" && args.formattingValues) {
|
1292 | var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
|
1293 | var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
|
1294 | valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
|
1295 | } else {
|
1296 | var _defaultWidth = args.defaultWidth;
|
1297 | var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
|
1298 | valuesArray = args.values[_width] || args.values[_defaultWidth];
|
1299 | }
|
1300 | var index = args.argumentCallback ? args.argumentCallback(value) : value;
|
1301 | return valuesArray[index];
|
1302 | };
|
1303 | }
|
1304 |
|
1305 |
|
1306 | var eraValues = {
|
1307 | narrow: ["B", "A"],
|
1308 | abbreviated: ["BC", "AD"],
|
1309 | wide: ["Before Christ", "Anno Domini"]
|
1310 | };
|
1311 | var quarterValues = {
|
1312 | narrow: ["1", "2", "3", "4"],
|
1313 | abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
1314 | wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
1315 | };
|
1316 | var monthValues = {
|
1317 | narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
1318 | abbreviated: [
|
1319 | "Jan",
|
1320 | "Feb",
|
1321 | "Mar",
|
1322 | "Apr",
|
1323 | "May",
|
1324 | "Jun",
|
1325 | "Jul",
|
1326 | "Aug",
|
1327 | "Sep",
|
1328 | "Oct",
|
1329 | "Nov",
|
1330 | "Dec"],
|
1331 |
|
1332 | wide: [
|
1333 | "January",
|
1334 | "February",
|
1335 | "March",
|
1336 | "April",
|
1337 | "May",
|
1338 | "June",
|
1339 | "July",
|
1340 | "August",
|
1341 | "September",
|
1342 | "October",
|
1343 | "November",
|
1344 | "December"]
|
1345 |
|
1346 | };
|
1347 | var dayValues = {
|
1348 | narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
1349 | short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
1350 | abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
1351 | wide: [
|
1352 | "Sunday",
|
1353 | "Monday",
|
1354 | "Tuesday",
|
1355 | "Wednesday",
|
1356 | "Thursday",
|
1357 | "Friday",
|
1358 | "Saturday"]
|
1359 |
|
1360 | };
|
1361 | var dayPeriodValues = {
|
1362 | narrow: {
|
1363 | am: "a",
|
1364 | pm: "p",
|
1365 | midnight: "mi",
|
1366 | noon: "n",
|
1367 | morning: "morning",
|
1368 | afternoon: "afternoon",
|
1369 | evening: "evening",
|
1370 | night: "night"
|
1371 | },
|
1372 | abbreviated: {
|
1373 | am: "AM",
|
1374 | pm: "PM",
|
1375 | midnight: "midnight",
|
1376 | noon: "noon",
|
1377 | morning: "morning",
|
1378 | afternoon: "afternoon",
|
1379 | evening: "evening",
|
1380 | night: "night"
|
1381 | },
|
1382 | wide: {
|
1383 | am: "a.m.",
|
1384 | pm: "p.m.",
|
1385 | midnight: "midnight",
|
1386 | noon: "noon",
|
1387 | morning: "morning",
|
1388 | afternoon: "afternoon",
|
1389 | evening: "evening",
|
1390 | night: "night"
|
1391 | }
|
1392 | };
|
1393 | var formattingDayPeriodValues = {
|
1394 | narrow: {
|
1395 | am: "a",
|
1396 | pm: "p",
|
1397 | midnight: "mi",
|
1398 | noon: "n",
|
1399 | morning: "in the morning",
|
1400 | afternoon: "in the afternoon",
|
1401 | evening: "in the evening",
|
1402 | night: "at night"
|
1403 | },
|
1404 | abbreviated: {
|
1405 | am: "AM",
|
1406 | pm: "PM",
|
1407 | midnight: "midnight",
|
1408 | noon: "noon",
|
1409 | morning: "in the morning",
|
1410 | afternoon: "in the afternoon",
|
1411 | evening: "in the evening",
|
1412 | night: "at night"
|
1413 | },
|
1414 | wide: {
|
1415 | am: "a.m.",
|
1416 | pm: "p.m.",
|
1417 | midnight: "midnight",
|
1418 | noon: "noon",
|
1419 | morning: "in the morning",
|
1420 | afternoon: "in the afternoon",
|
1421 | evening: "in the evening",
|
1422 | night: "at night"
|
1423 | }
|
1424 | };
|
1425 | var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
|
1426 | var number = Number(dirtyNumber);
|
1427 | var rem100 = number % 100;
|
1428 | if (rem100 > 20 || rem100 < 10) {
|
1429 | switch (rem100 % 10) {
|
1430 | case 1:
|
1431 | return number + "st";
|
1432 | case 2:
|
1433 | return number + "nd";
|
1434 | case 3:
|
1435 | return number + "rd";
|
1436 | }
|
1437 | }
|
1438 | return number + "th";
|
1439 | };
|
1440 | var localize = {
|
1441 | ordinalNumber: ordinalNumber,
|
1442 | era: buildLocalizeFn({
|
1443 | values: eraValues,
|
1444 | defaultWidth: "wide"
|
1445 | }),
|
1446 | quarter: buildLocalizeFn({
|
1447 | values: quarterValues,
|
1448 | defaultWidth: "wide",
|
1449 | argumentCallback: function argumentCallback(quarter) {return quarter - 1;}
|
1450 | }),
|
1451 | month: buildLocalizeFn({
|
1452 | values: monthValues,
|
1453 | defaultWidth: "wide"
|
1454 | }),
|
1455 | day: buildLocalizeFn({
|
1456 | values: dayValues,
|
1457 | defaultWidth: "wide"
|
1458 | }),
|
1459 | dayPeriod: buildLocalizeFn({
|
1460 | values: dayPeriodValues,
|
1461 | defaultWidth: "wide",
|
1462 | formattingValues: formattingDayPeriodValues,
|
1463 | defaultFormattingWidth: "wide"
|
1464 | })
|
1465 | };
|
1466 |
|
1467 |
|
1468 | function buildMatchFn(args) {
|
1469 | return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1470 | var width = options.width;
|
1471 | var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
|
1472 | var matchResult = string.match(matchPattern);
|
1473 | if (!matchResult) {
|
1474 | return null;
|
1475 | }
|
1476 | var matchedString = matchResult[0];
|
1477 | var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
|
1478 | var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {return pattern.test(matchedString);}) : findKey(parsePatterns, function (pattern) {return pattern.test(matchedString);});
|
1479 | var value;
|
1480 | value = args.valueCallback ? args.valueCallback(key) : key;
|
1481 | value = options.valueCallback ? options.valueCallback(value) : value;
|
1482 | var rest = string.slice(matchedString.length);
|
1483 | return { value: value, rest: rest };
|
1484 | };
|
1485 | }
|
1486 | function findKey(object, predicate) {
|
1487 | for (var key in object) {
|
1488 | if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
|
1489 | return key;
|
1490 | }
|
1491 | }
|
1492 | return;
|
1493 | }
|
1494 | function findIndex(array, predicate) {
|
1495 | for (var key = 0; key < array.length; key++) {
|
1496 | if (predicate(array[key])) {
|
1497 | return key;
|
1498 | }
|
1499 | }
|
1500 | return;
|
1501 | }
|
1502 |
|
1503 |
|
1504 | function buildMatchPatternFn(args) {
|
1505 | return function (string) {var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
1506 | var matchResult = string.match(args.matchPattern);
|
1507 | if (!matchResult)
|
1508 | return null;
|
1509 | var matchedString = matchResult[0];
|
1510 | var parseResult = string.match(args.parsePattern);
|
1511 | if (!parseResult)
|
1512 | return null;
|
1513 | var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
|
1514 | value = options.valueCallback ? options.valueCallback(value) : value;
|
1515 | var rest = string.slice(matchedString.length);
|
1516 | return { value: value, rest: rest };
|
1517 | };
|
1518 | }
|
1519 |
|
1520 |
|
1521 | var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
|
1522 | var parseOrdinalNumberPattern = /\d+/i;
|
1523 | var matchEraPatterns = {
|
1524 | narrow: /^(b|a)/i,
|
1525 | abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
1526 | wide: /^(before christ|before common era|anno domini|common era)/i
|
1527 | };
|
1528 | var parseEraPatterns = {
|
1529 | any: [/^b/i, /^(a|c)/i]
|
1530 | };
|
1531 | var matchQuarterPatterns = {
|
1532 | narrow: /^[1234]/i,
|
1533 | abbreviated: /^q[1234]/i,
|
1534 | wide: /^[1234](th|st|nd|rd)? quarter/i
|
1535 | };
|
1536 | var parseQuarterPatterns = {
|
1537 | any: [/1/i, /2/i, /3/i, /4/i]
|
1538 | };
|
1539 | var matchMonthPatterns = {
|
1540 | narrow: /^[jfmasond]/i,
|
1541 | abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
1542 | wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
1543 | };
|
1544 | var parseMonthPatterns = {
|
1545 | narrow: [
|
1546 | /^j/i,
|
1547 | /^f/i,
|
1548 | /^m/i,
|
1549 | /^a/i,
|
1550 | /^m/i,
|
1551 | /^j/i,
|
1552 | /^j/i,
|
1553 | /^a/i,
|
1554 | /^s/i,
|
1555 | /^o/i,
|
1556 | /^n/i,
|
1557 | /^d/i],
|
1558 |
|
1559 | any: [
|
1560 | /^ja/i,
|
1561 | /^f/i,
|
1562 | /^mar/i,
|
1563 | /^ap/i,
|
1564 | /^may/i,
|
1565 | /^jun/i,
|
1566 | /^jul/i,
|
1567 | /^au/i,
|
1568 | /^s/i,
|
1569 | /^o/i,
|
1570 | /^n/i,
|
1571 | /^d/i]
|
1572 |
|
1573 | };
|
1574 | var matchDayPatterns = {
|
1575 | narrow: /^[smtwf]/i,
|
1576 | short: /^(su|mo|tu|we|th|fr|sa)/i,
|
1577 | abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
1578 | wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
1579 | };
|
1580 | var parseDayPatterns = {
|
1581 | narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
1582 | any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
1583 | };
|
1584 | var matchDayPeriodPatterns = {
|
1585 | narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
1586 | any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
1587 | };
|
1588 | var parseDayPeriodPatterns = {
|
1589 | any: {
|
1590 | am: /^a/i,
|
1591 | pm: /^p/i,
|
1592 | midnight: /^mi/i,
|
1593 | noon: /^no/i,
|
1594 | morning: /morning/i,
|
1595 | afternoon: /afternoon/i,
|
1596 | evening: /evening/i,
|
1597 | night: /night/i
|
1598 | }
|
1599 | };
|
1600 | var match = {
|
1601 | ordinalNumber: buildMatchPatternFn({
|
1602 | matchPattern: matchOrdinalNumberPattern,
|
1603 | parsePattern: parseOrdinalNumberPattern,
|
1604 | valueCallback: function valueCallback(value) {return parseInt(value, 10);}
|
1605 | }),
|
1606 | era: buildMatchFn({
|
1607 | matchPatterns: matchEraPatterns,
|
1608 | defaultMatchWidth: "wide",
|
1609 | parsePatterns: parseEraPatterns,
|
1610 | defaultParseWidth: "any"
|
1611 | }),
|
1612 | quarter: buildMatchFn({
|
1613 | matchPatterns: matchQuarterPatterns,
|
1614 | defaultMatchWidth: "wide",
|
1615 | parsePatterns: parseQuarterPatterns,
|
1616 | defaultParseWidth: "any",
|
1617 | valueCallback: function valueCallback(index) {return index + 1;}
|
1618 | }),
|
1619 | month: buildMatchFn({
|
1620 | matchPatterns: matchMonthPatterns,
|
1621 | defaultMatchWidth: "wide",
|
1622 | parsePatterns: parseMonthPatterns,
|
1623 | defaultParseWidth: "any"
|
1624 | }),
|
1625 | day: buildMatchFn({
|
1626 | matchPatterns: matchDayPatterns,
|
1627 | defaultMatchWidth: "wide",
|
1628 | parsePatterns: parseDayPatterns,
|
1629 | defaultParseWidth: "any"
|
1630 | }),
|
1631 | dayPeriod: buildMatchFn({
|
1632 | matchPatterns: matchDayPeriodPatterns,
|
1633 | defaultMatchWidth: "any",
|
1634 | parsePatterns: parseDayPeriodPatterns,
|
1635 | defaultParseWidth: "any"
|
1636 | })
|
1637 | };
|
1638 |
|
1639 |
|
1640 | var enUS = {
|
1641 | code: "en-US",
|
1642 | formatDistance: formatDistance,
|
1643 | formatLong: formatLong,
|
1644 | formatRelative: formatRelative,
|
1645 | localize: localize,
|
1646 | match: match,
|
1647 | options: {
|
1648 | weekStartsOn: 0,
|
1649 | firstWeekContainsDate: 1
|
1650 | }
|
1651 | };
|
1652 |
|
1653 | function _getDayOfYear(date, options) {
|
1654 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1655 | var diff = _differenceInCalendarDays(_date, _startOfYear(_date));
|
1656 | var dayOfYear = diff + 1;
|
1657 | return dayOfYear;
|
1658 | }
|
1659 |
|
1660 |
|
1661 | function _getISOWeek(date, options) {
|
1662 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1663 | var diff = +_startOfISOWeek(_date) - +_startOfISOWeekYear(_date);
|
1664 | return Math.round(diff / millisecondsInWeek) + 1;
|
1665 | }
|
1666 |
|
1667 |
|
1668 | function _getWeekYear(date, options) {var _ref7, _ref8, _ref9, _options$firstWeekCon, _options$locale3, _defaultOptions5$loca;
|
1669 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1670 | var year = _date.getFullYear();
|
1671 | var defaultOptions5 = getDefaultOptions();
|
1672 | var firstWeekContainsDate = (_ref7 = (_ref8 = (_ref9 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 || (_options$locale3 = options.locale) === null || _options$locale3 === void 0 || (_options$locale3 = _options$locale3.options) === null || _options$locale3 === void 0 ? void 0 : _options$locale3.firstWeekContainsDate) !== null && _ref9 !== void 0 ? _ref9 : defaultOptions5.firstWeekContainsDate) !== null && _ref8 !== void 0 ? _ref8 : (_defaultOptions5$loca = defaultOptions5.locale) === null || _defaultOptions5$loca === void 0 || (_defaultOptions5$loca = _defaultOptions5$loca.options) === null || _defaultOptions5$loca === void 0 ? void 0 : _defaultOptions5$loca.firstWeekContainsDate) !== null && _ref7 !== void 0 ? _ref7 : 1;
|
1673 | var firstWeekOfNextYear = _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, 0);
|
1674 | firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
|
1675 | firstWeekOfNextYear.setHours(0, 0, 0, 0);
|
1676 | var startOfNextYear = _startOfWeek(firstWeekOfNextYear, options);
|
1677 | var firstWeekOfThisYear = _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, 0);
|
1678 | firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
|
1679 | firstWeekOfThisYear.setHours(0, 0, 0, 0);
|
1680 | var startOfThisYear = _startOfWeek(firstWeekOfThisYear, options);
|
1681 | if (+_date >= +startOfNextYear) {
|
1682 | return year + 1;
|
1683 | } else if (+_date >= +startOfThisYear) {
|
1684 | return year;
|
1685 | } else {
|
1686 | return year - 1;
|
1687 | }
|
1688 | }
|
1689 |
|
1690 |
|
1691 | function _startOfWeekYear(date, options) {var _ref10, _ref11, _ref12, _options$firstWeekCon2, _options$locale4, _defaultOptions6$loca;
|
1692 | var defaultOptions6 = getDefaultOptions();
|
1693 | var firstWeekContainsDate = (_ref10 = (_ref11 = (_ref12 = (_options$firstWeekCon2 = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon2 !== void 0 ? _options$firstWeekCon2 : options === null || options === void 0 || (_options$locale4 = options.locale) === null || _options$locale4 === void 0 || (_options$locale4 = _options$locale4.options) === null || _options$locale4 === void 0 ? void 0 : _options$locale4.firstWeekContainsDate) !== null && _ref12 !== void 0 ? _ref12 : defaultOptions6.firstWeekContainsDate) !== null && _ref11 !== void 0 ? _ref11 : (_defaultOptions6$loca = defaultOptions6.locale) === null || _defaultOptions6$loca === void 0 || (_defaultOptions6$loca = _defaultOptions6$loca.options) === null || _defaultOptions6$loca === void 0 ? void 0 : _defaultOptions6$loca.firstWeekContainsDate) !== null && _ref10 !== void 0 ? _ref10 : 1;
|
1694 | var year = _getWeekYear(date, options);
|
1695 | var firstWeek = _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, 0);
|
1696 | firstWeek.setFullYear(year, 0, firstWeekContainsDate);
|
1697 | firstWeek.setHours(0, 0, 0, 0);
|
1698 | var _date = _startOfWeek(firstWeek, options);
|
1699 | return _date;
|
1700 | }
|
1701 |
|
1702 |
|
1703 | function _getWeek(date, options) {
|
1704 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
1705 | var diff = +_startOfWeek(_date, options) - +_startOfWeekYear(_date, options);
|
1706 | return Math.round(diff / millisecondsInWeek) + 1;
|
1707 | }
|
1708 |
|
1709 |
|
1710 | function addLeadingZeros(number, targetLength) {
|
1711 | var sign = number < 0 ? "-" : "";
|
1712 | var output = Math.abs(number).toString().padStart(targetLength, "0");
|
1713 | return sign + output;
|
1714 | }
|
1715 |
|
1716 |
|
1717 | var _lightFormatters = {
|
1718 | y: function y(date, token) {
|
1719 | var signedYear = date.getFullYear();
|
1720 | var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
1721 | return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
1722 | },
|
1723 | M: function M(date, token) {
|
1724 | var month = date.getMonth();
|
1725 | return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
1726 | },
|
1727 | d: function d(date, token) {
|
1728 | return addLeadingZeros(date.getDate(), token.length);
|
1729 | },
|
1730 | a: function a(date, token) {
|
1731 | var dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
1732 | switch (token) {
|
1733 | case "a":
|
1734 | case "aa":
|
1735 | return dayPeriodEnumValue.toUpperCase();
|
1736 | case "aaa":
|
1737 | return dayPeriodEnumValue;
|
1738 | case "aaaaa":
|
1739 | return dayPeriodEnumValue[0];
|
1740 | case "aaaa":
|
1741 | default:
|
1742 | return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
|
1743 | }
|
1744 | },
|
1745 | h: function h(date, token) {
|
1746 | return addLeadingZeros(date.getHours() % 12 || 12, token.length);
|
1747 | },
|
1748 | H: function H(date, token) {
|
1749 | return addLeadingZeros(date.getHours(), token.length);
|
1750 | },
|
1751 | m: function m(date, token) {
|
1752 | return addLeadingZeros(date.getMinutes(), token.length);
|
1753 | },
|
1754 | s: function s(date, token) {
|
1755 | return addLeadingZeros(date.getSeconds(), token.length);
|
1756 | },
|
1757 | S: function S(date, token) {
|
1758 | var numberOfDigits = token.length;
|
1759 | var milliseconds = date.getMilliseconds();
|
1760 | var fractionalSeconds = Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3));
|
1761 | return addLeadingZeros(fractionalSeconds, token.length);
|
1762 | }
|
1763 | };
|
1764 |
|
1765 |
|
1766 | function formatTimezoneShort(offset) {var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
1767 | var sign = offset > 0 ? "-" : "+";
|
1768 | var absOffset = Math.abs(offset);
|
1769 | var hours = Math.trunc(absOffset / 60);
|
1770 | var minutes = absOffset % 60;
|
1771 | if (minutes === 0) {
|
1772 | return sign + String(hours);
|
1773 | }
|
1774 | return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
1775 | }
|
1776 | function formatTimezoneWithOptionalMinutes(offset, delimiter) {
|
1777 | if (offset % 60 === 0) {
|
1778 | var sign = offset > 0 ? "-" : "+";
|
1779 | return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
|
1780 | }
|
1781 | return formatTimezone(offset, delimiter);
|
1782 | }
|
1783 | function formatTimezone(offset) {var delimiter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
1784 | var sign = offset > 0 ? "-" : "+";
|
1785 | var absOffset = Math.abs(offset);
|
1786 | var hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
|
1787 | var minutes = addLeadingZeros(absOffset % 60, 2);
|
1788 | return sign + hours + delimiter + minutes;
|
1789 | }
|
1790 | var dayPeriodEnum = {
|
1791 | am: "am",
|
1792 | pm: "pm",
|
1793 | midnight: "midnight",
|
1794 | noon: "noon",
|
1795 | morning: "morning",
|
1796 | afternoon: "afternoon",
|
1797 | evening: "evening",
|
1798 | night: "night"
|
1799 | };
|
1800 | var _formatters = {
|
1801 | G: function G(date, token, localize3) {
|
1802 | var era = date.getFullYear() > 0 ? 1 : 0;
|
1803 | switch (token) {
|
1804 | case "G":
|
1805 | case "GG":
|
1806 | case "GGG":
|
1807 | return localize3.era(era, { width: "abbreviated" });
|
1808 | case "GGGGG":
|
1809 | return localize3.era(era, { width: "narrow" });
|
1810 | case "GGGG":
|
1811 | default:
|
1812 | return localize3.era(era, { width: "wide" });
|
1813 | }
|
1814 | },
|
1815 | y: function y(date, token, localize3) {
|
1816 | if (token === "yo") {
|
1817 | var signedYear = date.getFullYear();
|
1818 | var year = signedYear > 0 ? signedYear : 1 - signedYear;
|
1819 | return localize3.ordinalNumber(year, { unit: "year" });
|
1820 | }
|
1821 | return _lightFormatters.y(date, token);
|
1822 | },
|
1823 | Y: function Y(date, token, localize3, options) {
|
1824 | var signedWeekYear = _getWeekYear(date, options);
|
1825 | var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
1826 | if (token === "YY") {
|
1827 | var twoDigitYear = weekYear % 100;
|
1828 | return addLeadingZeros(twoDigitYear, 2);
|
1829 | }
|
1830 | if (token === "Yo") {
|
1831 | return localize3.ordinalNumber(weekYear, { unit: "year" });
|
1832 | }
|
1833 | return addLeadingZeros(weekYear, token.length);
|
1834 | },
|
1835 | R: function R(date, token) {
|
1836 | var isoWeekYear = _getISOWeekYear(date);
|
1837 | return addLeadingZeros(isoWeekYear, token.length);
|
1838 | },
|
1839 | u: function u(date, token) {
|
1840 | var year = date.getFullYear();
|
1841 | return addLeadingZeros(year, token.length);
|
1842 | },
|
1843 | Q: function Q(date, token, localize3) {
|
1844 | var quarter = Math.ceil((date.getMonth() + 1) / 3);
|
1845 | switch (token) {
|
1846 | case "Q":
|
1847 | return String(quarter);
|
1848 | case "QQ":
|
1849 | return addLeadingZeros(quarter, 2);
|
1850 | case "Qo":
|
1851 | return localize3.ordinalNumber(quarter, { unit: "quarter" });
|
1852 | case "QQQ":
|
1853 | return localize3.quarter(quarter, {
|
1854 | width: "abbreviated",
|
1855 | context: "formatting"
|
1856 | });
|
1857 | case "QQQQQ":
|
1858 | return localize3.quarter(quarter, {
|
1859 | width: "narrow",
|
1860 | context: "formatting"
|
1861 | });
|
1862 | case "QQQQ":
|
1863 | default:
|
1864 | return localize3.quarter(quarter, {
|
1865 | width: "wide",
|
1866 | context: "formatting"
|
1867 | });
|
1868 | }
|
1869 | },
|
1870 | q: function q(date, token, localize3) {
|
1871 | var quarter = Math.ceil((date.getMonth() + 1) / 3);
|
1872 | switch (token) {
|
1873 | case "q":
|
1874 | return String(quarter);
|
1875 | case "qq":
|
1876 | return addLeadingZeros(quarter, 2);
|
1877 | case "qo":
|
1878 | return localize3.ordinalNumber(quarter, { unit: "quarter" });
|
1879 | case "qqq":
|
1880 | return localize3.quarter(quarter, {
|
1881 | width: "abbreviated",
|
1882 | context: "standalone"
|
1883 | });
|
1884 | case "qqqqq":
|
1885 | return localize3.quarter(quarter, {
|
1886 | width: "narrow",
|
1887 | context: "standalone"
|
1888 | });
|
1889 | case "qqqq":
|
1890 | default:
|
1891 | return localize3.quarter(quarter, {
|
1892 | width: "wide",
|
1893 | context: "standalone"
|
1894 | });
|
1895 | }
|
1896 | },
|
1897 | M: function M(date, token, localize3) {
|
1898 | var month = date.getMonth();
|
1899 | switch (token) {
|
1900 | case "M":
|
1901 | case "MM":
|
1902 | return _lightFormatters.M(date, token);
|
1903 | case "Mo":
|
1904 | return localize3.ordinalNumber(month + 1, { unit: "month" });
|
1905 | case "MMM":
|
1906 | return localize3.month(month, {
|
1907 | width: "abbreviated",
|
1908 | context: "formatting"
|
1909 | });
|
1910 | case "MMMMM":
|
1911 | return localize3.month(month, {
|
1912 | width: "narrow",
|
1913 | context: "formatting"
|
1914 | });
|
1915 | case "MMMM":
|
1916 | default:
|
1917 | return localize3.month(month, { width: "wide", context: "formatting" });
|
1918 | }
|
1919 | },
|
1920 | L: function L(date, token, localize3) {
|
1921 | var month = date.getMonth();
|
1922 | switch (token) {
|
1923 | case "L":
|
1924 | return String(month + 1);
|
1925 | case "LL":
|
1926 | return addLeadingZeros(month + 1, 2);
|
1927 | case "Lo":
|
1928 | return localize3.ordinalNumber(month + 1, { unit: "month" });
|
1929 | case "LLL":
|
1930 | return localize3.month(month, {
|
1931 | width: "abbreviated",
|
1932 | context: "standalone"
|
1933 | });
|
1934 | case "LLLLL":
|
1935 | return localize3.month(month, {
|
1936 | width: "narrow",
|
1937 | context: "standalone"
|
1938 | });
|
1939 | case "LLLL":
|
1940 | default:
|
1941 | return localize3.month(month, { width: "wide", context: "standalone" });
|
1942 | }
|
1943 | },
|
1944 | w: function w(date, token, localize3, options) {
|
1945 | var week = _getWeek(date, options);
|
1946 | if (token === "wo") {
|
1947 | return localize3.ordinalNumber(week, { unit: "week" });
|
1948 | }
|
1949 | return addLeadingZeros(week, token.length);
|
1950 | },
|
1951 | I: function I(date, token, localize3) {
|
1952 | var isoWeek = _getISOWeek(date);
|
1953 | if (token === "Io") {
|
1954 | return localize3.ordinalNumber(isoWeek, { unit: "week" });
|
1955 | }
|
1956 | return addLeadingZeros(isoWeek, token.length);
|
1957 | },
|
1958 | d: function d(date, token, localize3) {
|
1959 | if (token === "do") {
|
1960 | return localize3.ordinalNumber(date.getDate(), { unit: "date" });
|
1961 | }
|
1962 | return _lightFormatters.d(date, token);
|
1963 | },
|
1964 | D: function D(date, token, localize3) {
|
1965 | var dayOfYear = _getDayOfYear(date);
|
1966 | if (token === "Do") {
|
1967 | return localize3.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
|
1968 | }
|
1969 | return addLeadingZeros(dayOfYear, token.length);
|
1970 | },
|
1971 | E: function E(date, token, localize3) {
|
1972 | var dayOfWeek = date.getDay();
|
1973 | switch (token) {
|
1974 | case "E":
|
1975 | case "EE":
|
1976 | case "EEE":
|
1977 | return localize3.day(dayOfWeek, {
|
1978 | width: "abbreviated",
|
1979 | context: "formatting"
|
1980 | });
|
1981 | case "EEEEE":
|
1982 | return localize3.day(dayOfWeek, {
|
1983 | width: "narrow",
|
1984 | context: "formatting"
|
1985 | });
|
1986 | case "EEEEEE":
|
1987 | return localize3.day(dayOfWeek, {
|
1988 | width: "short",
|
1989 | context: "formatting"
|
1990 | });
|
1991 | case "EEEE":
|
1992 | default:
|
1993 | return localize3.day(dayOfWeek, {
|
1994 | width: "wide",
|
1995 | context: "formatting"
|
1996 | });
|
1997 | }
|
1998 | },
|
1999 | e: function e(date, token, localize3, options) {
|
2000 | var dayOfWeek = date.getDay();
|
2001 | var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
2002 | switch (token) {
|
2003 | case "e":
|
2004 | return String(localDayOfWeek);
|
2005 | case "ee":
|
2006 | return addLeadingZeros(localDayOfWeek, 2);
|
2007 | case "eo":
|
2008 | return localize3.ordinalNumber(localDayOfWeek, { unit: "day" });
|
2009 | case "eee":
|
2010 | return localize3.day(dayOfWeek, {
|
2011 | width: "abbreviated",
|
2012 | context: "formatting"
|
2013 | });
|
2014 | case "eeeee":
|
2015 | return localize3.day(dayOfWeek, {
|
2016 | width: "narrow",
|
2017 | context: "formatting"
|
2018 | });
|
2019 | case "eeeeee":
|
2020 | return localize3.day(dayOfWeek, {
|
2021 | width: "short",
|
2022 | context: "formatting"
|
2023 | });
|
2024 | case "eeee":
|
2025 | default:
|
2026 | return localize3.day(dayOfWeek, {
|
2027 | width: "wide",
|
2028 | context: "formatting"
|
2029 | });
|
2030 | }
|
2031 | },
|
2032 | c: function c(date, token, localize3, options) {
|
2033 | var dayOfWeek = date.getDay();
|
2034 | var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
2035 | switch (token) {
|
2036 | case "c":
|
2037 | return String(localDayOfWeek);
|
2038 | case "cc":
|
2039 | return addLeadingZeros(localDayOfWeek, token.length);
|
2040 | case "co":
|
2041 | return localize3.ordinalNumber(localDayOfWeek, { unit: "day" });
|
2042 | case "ccc":
|
2043 | return localize3.day(dayOfWeek, {
|
2044 | width: "abbreviated",
|
2045 | context: "standalone"
|
2046 | });
|
2047 | case "ccccc":
|
2048 | return localize3.day(dayOfWeek, {
|
2049 | width: "narrow",
|
2050 | context: "standalone"
|
2051 | });
|
2052 | case "cccccc":
|
2053 | return localize3.day(dayOfWeek, {
|
2054 | width: "short",
|
2055 | context: "standalone"
|
2056 | });
|
2057 | case "cccc":
|
2058 | default:
|
2059 | return localize3.day(dayOfWeek, {
|
2060 | width: "wide",
|
2061 | context: "standalone"
|
2062 | });
|
2063 | }
|
2064 | },
|
2065 | i: function i(date, token, localize3) {
|
2066 | var dayOfWeek = date.getDay();
|
2067 | var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
2068 | switch (token) {
|
2069 | case "i":
|
2070 | return String(isoDayOfWeek);
|
2071 | case "ii":
|
2072 | return addLeadingZeros(isoDayOfWeek, token.length);
|
2073 | case "io":
|
2074 | return localize3.ordinalNumber(isoDayOfWeek, { unit: "day" });
|
2075 | case "iii":
|
2076 | return localize3.day(dayOfWeek, {
|
2077 | width: "abbreviated",
|
2078 | context: "formatting"
|
2079 | });
|
2080 | case "iiiii":
|
2081 | return localize3.day(dayOfWeek, {
|
2082 | width: "narrow",
|
2083 | context: "formatting"
|
2084 | });
|
2085 | case "iiiiii":
|
2086 | return localize3.day(dayOfWeek, {
|
2087 | width: "short",
|
2088 | context: "formatting"
|
2089 | });
|
2090 | case "iiii":
|
2091 | default:
|
2092 | return localize3.day(dayOfWeek, {
|
2093 | width: "wide",
|
2094 | context: "formatting"
|
2095 | });
|
2096 | }
|
2097 | },
|
2098 | a: function a(date, token, localize3) {
|
2099 | var hours = date.getHours();
|
2100 | var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
2101 | switch (token) {
|
2102 | case "a":
|
2103 | case "aa":
|
2104 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2105 | width: "abbreviated",
|
2106 | context: "formatting"
|
2107 | });
|
2108 | case "aaa":
|
2109 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2110 | width: "abbreviated",
|
2111 | context: "formatting"
|
2112 | }).toLowerCase();
|
2113 | case "aaaaa":
|
2114 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2115 | width: "narrow",
|
2116 | context: "formatting"
|
2117 | });
|
2118 | case "aaaa":
|
2119 | default:
|
2120 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2121 | width: "wide",
|
2122 | context: "formatting"
|
2123 | });
|
2124 | }
|
2125 | },
|
2126 | b: function b(date, token, localize3) {
|
2127 | var hours = date.getHours();
|
2128 | var dayPeriodEnumValue;
|
2129 | if (hours === 12) {
|
2130 | dayPeriodEnumValue = dayPeriodEnum.noon;
|
2131 | } else if (hours === 0) {
|
2132 | dayPeriodEnumValue = dayPeriodEnum.midnight;
|
2133 | } else {
|
2134 | dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
2135 | }
|
2136 | switch (token) {
|
2137 | case "b":
|
2138 | case "bb":
|
2139 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2140 | width: "abbreviated",
|
2141 | context: "formatting"
|
2142 | });
|
2143 | case "bbb":
|
2144 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2145 | width: "abbreviated",
|
2146 | context: "formatting"
|
2147 | }).toLowerCase();
|
2148 | case "bbbbb":
|
2149 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2150 | width: "narrow",
|
2151 | context: "formatting"
|
2152 | });
|
2153 | case "bbbb":
|
2154 | default:
|
2155 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2156 | width: "wide",
|
2157 | context: "formatting"
|
2158 | });
|
2159 | }
|
2160 | },
|
2161 | B: function B(date, token, localize3) {
|
2162 | var hours = date.getHours();
|
2163 | var dayPeriodEnumValue;
|
2164 | if (hours >= 17) {
|
2165 | dayPeriodEnumValue = dayPeriodEnum.evening;
|
2166 | } else if (hours >= 12) {
|
2167 | dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
2168 | } else if (hours >= 4) {
|
2169 | dayPeriodEnumValue = dayPeriodEnum.morning;
|
2170 | } else {
|
2171 | dayPeriodEnumValue = dayPeriodEnum.night;
|
2172 | }
|
2173 | switch (token) {
|
2174 | case "B":
|
2175 | case "BB":
|
2176 | case "BBB":
|
2177 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2178 | width: "abbreviated",
|
2179 | context: "formatting"
|
2180 | });
|
2181 | case "BBBBB":
|
2182 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2183 | width: "narrow",
|
2184 | context: "formatting"
|
2185 | });
|
2186 | case "BBBB":
|
2187 | default:
|
2188 | return localize3.dayPeriod(dayPeriodEnumValue, {
|
2189 | width: "wide",
|
2190 | context: "formatting"
|
2191 | });
|
2192 | }
|
2193 | },
|
2194 | h: function h(date, token, localize3) {
|
2195 | if (token === "ho") {
|
2196 | var hours = date.getHours() % 12;
|
2197 | if (hours === 0)
|
2198 | hours = 12;
|
2199 | return localize3.ordinalNumber(hours, { unit: "hour" });
|
2200 | }
|
2201 | return _lightFormatters.h(date, token);
|
2202 | },
|
2203 | H: function H(date, token, localize3) {
|
2204 | if (token === "Ho") {
|
2205 | return localize3.ordinalNumber(date.getHours(), { unit: "hour" });
|
2206 | }
|
2207 | return _lightFormatters.H(date, token);
|
2208 | },
|
2209 | K: function K(date, token, localize3) {
|
2210 | var hours = date.getHours() % 12;
|
2211 | if (token === "Ko") {
|
2212 | return localize3.ordinalNumber(hours, { unit: "hour" });
|
2213 | }
|
2214 | return addLeadingZeros(hours, token.length);
|
2215 | },
|
2216 | k: function k(date, token, localize3) {
|
2217 | var hours = date.getHours();
|
2218 | if (hours === 0)
|
2219 | hours = 24;
|
2220 | if (token === "ko") {
|
2221 | return localize3.ordinalNumber(hours, { unit: "hour" });
|
2222 | }
|
2223 | return addLeadingZeros(hours, token.length);
|
2224 | },
|
2225 | m: function m(date, token, localize3) {
|
2226 | if (token === "mo") {
|
2227 | return localize3.ordinalNumber(date.getMinutes(), { unit: "minute" });
|
2228 | }
|
2229 | return _lightFormatters.m(date, token);
|
2230 | },
|
2231 | s: function s(date, token, localize3) {
|
2232 | if (token === "so") {
|
2233 | return localize3.ordinalNumber(date.getSeconds(), { unit: "second" });
|
2234 | }
|
2235 | return _lightFormatters.s(date, token);
|
2236 | },
|
2237 | S: function S(date, token) {
|
2238 | return _lightFormatters.S(date, token);
|
2239 | },
|
2240 | X: function X(date, token, _localize) {
|
2241 | var timezoneOffset = date.getTimezoneOffset();
|
2242 | if (timezoneOffset === 0) {
|
2243 | return "Z";
|
2244 | }
|
2245 | switch (token) {
|
2246 | case "X":
|
2247 | return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
2248 | case "XXXX":
|
2249 | case "XX":
|
2250 | return formatTimezone(timezoneOffset);
|
2251 | case "XXXXX":
|
2252 | case "XXX":
|
2253 | default:
|
2254 | return formatTimezone(timezoneOffset, ":");
|
2255 | }
|
2256 | },
|
2257 | x: function x(date, token, _localize) {
|
2258 | var timezoneOffset = date.getTimezoneOffset();
|
2259 | switch (token) {
|
2260 | case "x":
|
2261 | return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
2262 | case "xxxx":
|
2263 | case "xx":
|
2264 | return formatTimezone(timezoneOffset);
|
2265 | case "xxxxx":
|
2266 | case "xxx":
|
2267 | default:
|
2268 | return formatTimezone(timezoneOffset, ":");
|
2269 | }
|
2270 | },
|
2271 | O: function O(date, token, _localize) {
|
2272 | var timezoneOffset = date.getTimezoneOffset();
|
2273 | switch (token) {
|
2274 | case "O":
|
2275 | case "OO":
|
2276 | case "OOO":
|
2277 | return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
2278 | case "OOOO":
|
2279 | default:
|
2280 | return "GMT" + formatTimezone(timezoneOffset, ":");
|
2281 | }
|
2282 | },
|
2283 | z: function z(date, token, _localize) {
|
2284 | var timezoneOffset = date.getTimezoneOffset();
|
2285 | switch (token) {
|
2286 | case "z":
|
2287 | case "zz":
|
2288 | case "zzz":
|
2289 | return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
2290 | case "zzzz":
|
2291 | default:
|
2292 | return "GMT" + formatTimezone(timezoneOffset, ":");
|
2293 | }
|
2294 | },
|
2295 | t: function t(date, token, _localize) {
|
2296 | var timestamp = Math.trunc(+date / 1000);
|
2297 | return addLeadingZeros(timestamp, token.length);
|
2298 | },
|
2299 | T: function T(date, token, _localize) {
|
2300 | return addLeadingZeros(+date, token.length);
|
2301 | }
|
2302 | };
|
2303 |
|
2304 |
|
2305 | var dateLongFormatter = function dateLongFormatter(pattern, formatLong3) {
|
2306 | switch (pattern) {
|
2307 | case "P":
|
2308 | return formatLong3.date({ width: "short" });
|
2309 | case "PP":
|
2310 | return formatLong3.date({ width: "medium" });
|
2311 | case "PPP":
|
2312 | return formatLong3.date({ width: "long" });
|
2313 | case "PPPP":
|
2314 | default:
|
2315 | return formatLong3.date({ width: "full" });
|
2316 | }
|
2317 | };
|
2318 | var timeLongFormatter = function timeLongFormatter(pattern, formatLong3) {
|
2319 | switch (pattern) {
|
2320 | case "p":
|
2321 | return formatLong3.time({ width: "short" });
|
2322 | case "pp":
|
2323 | return formatLong3.time({ width: "medium" });
|
2324 | case "ppp":
|
2325 | return formatLong3.time({ width: "long" });
|
2326 | case "pppp":
|
2327 | default:
|
2328 | return formatLong3.time({ width: "full" });
|
2329 | }
|
2330 | };
|
2331 | var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong3) {
|
2332 | var matchResult = pattern.match(/(P+)(p+)?/) || [];
|
2333 | var datePattern = matchResult[1];
|
2334 | var timePattern = matchResult[2];
|
2335 | if (!timePattern) {
|
2336 | return dateLongFormatter(pattern, formatLong3);
|
2337 | }
|
2338 | var dateTimeFormat;
|
2339 | switch (datePattern) {
|
2340 | case "P":
|
2341 | dateTimeFormat = formatLong3.dateTime({ width: "short" });
|
2342 | break;
|
2343 | case "PP":
|
2344 | dateTimeFormat = formatLong3.dateTime({ width: "medium" });
|
2345 | break;
|
2346 | case "PPP":
|
2347 | dateTimeFormat = formatLong3.dateTime({ width: "long" });
|
2348 | break;
|
2349 | case "PPPP":
|
2350 | default:
|
2351 | dateTimeFormat = formatLong3.dateTime({ width: "full" });
|
2352 | break;
|
2353 | }
|
2354 | return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong3)).replace("{{time}}", timeLongFormatter(timePattern, formatLong3));
|
2355 | };
|
2356 | var _longFormatters = {
|
2357 | p: timeLongFormatter,
|
2358 | P: dateTimeLongFormatter
|
2359 | };
|
2360 |
|
2361 |
|
2362 | function isProtectedDayOfYearToken(token) {
|
2363 | return dayOfYearTokenRE.test(token);
|
2364 | }
|
2365 | function isProtectedWeekYearToken(token) {
|
2366 | return weekYearTokenRE.test(token);
|
2367 | }
|
2368 | function warnOrThrowProtectedError(token, format, input) {
|
2369 | var _message = message(token, format, input);
|
2370 | console.warn(_message);
|
2371 | if (throwTokens.includes(token))
|
2372 | throw new RangeError(_message);
|
2373 | }
|
2374 | function message(token, format, input) {
|
2375 | var subject = token[0] === "Y" ? "years" : "days of the month";
|
2376 | return "Use `".concat(token.toLowerCase(), "` instead of `").concat(token, "` (in `").concat(format, "`) for formatting ").concat(subject, " to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md");
|
2377 | }
|
2378 | var dayOfYearTokenRE = /^D+$/;
|
2379 | var weekYearTokenRE = /^Y+$/;
|
2380 | var throwTokens = ["D", "DD", "YY", "YYYY"];
|
2381 |
|
2382 |
|
2383 | function _format(date, formatStr, options) {var _ref13, _options$locale5, _ref14, _ref15, _ref16, _options$firstWeekCon3, _options$locale6, _defaultOptions7$loca, _ref17, _ref18, _ref19, _options$weekStartsOn3, _options$locale7, _defaultOptions7$loca2;
|
2384 | var defaultOptions7 = getDefaultOptions();
|
2385 | var locale = (_ref13 = (_options$locale5 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale5 !== void 0 ? _options$locale5 : defaultOptions7.locale) !== null && _ref13 !== void 0 ? _ref13 : enUS;
|
2386 | var firstWeekContainsDate = (_ref14 = (_ref15 = (_ref16 = (_options$firstWeekCon3 = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon3 !== void 0 ? _options$firstWeekCon3 : options === null || options === void 0 || (_options$locale6 = options.locale) === null || _options$locale6 === void 0 || (_options$locale6 = _options$locale6.options) === null || _options$locale6 === void 0 ? void 0 : _options$locale6.firstWeekContainsDate) !== null && _ref16 !== void 0 ? _ref16 : defaultOptions7.firstWeekContainsDate) !== null && _ref15 !== void 0 ? _ref15 : (_defaultOptions7$loca = defaultOptions7.locale) === null || _defaultOptions7$loca === void 0 || (_defaultOptions7$loca = _defaultOptions7$loca.options) === null || _defaultOptions7$loca === void 0 ? void 0 : _defaultOptions7$loca.firstWeekContainsDate) !== null && _ref14 !== void 0 ? _ref14 : 1;
|
2387 | var weekStartsOn = (_ref17 = (_ref18 = (_ref19 = (_options$weekStartsOn3 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn3 !== void 0 ? _options$weekStartsOn3 : options === null || options === void 0 || (_options$locale7 = options.locale) === null || _options$locale7 === void 0 || (_options$locale7 = _options$locale7.options) === null || _options$locale7 === void 0 ? void 0 : _options$locale7.weekStartsOn) !== null && _ref19 !== void 0 ? _ref19 : defaultOptions7.weekStartsOn) !== null && _ref18 !== void 0 ? _ref18 : (_defaultOptions7$loca2 = defaultOptions7.locale) === null || _defaultOptions7$loca2 === void 0 || (_defaultOptions7$loca2 = _defaultOptions7$loca2.options) === null || _defaultOptions7$loca2 === void 0 ? void 0 : _defaultOptions7$loca2.weekStartsOn) !== null && _ref17 !== void 0 ? _ref17 : 0;
|
2388 | var originalDate = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
2389 | if (!_isValid(originalDate)) {
|
2390 | throw new RangeError("Invalid time value");
|
2391 | }
|
2392 | var parts = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
|
2393 | var firstCharacter = substring[0];
|
2394 | if (firstCharacter === "p" || firstCharacter === "P") {
|
2395 | var longFormatter = _longFormatters[firstCharacter];
|
2396 | return longFormatter(substring, locale.formatLong);
|
2397 | }
|
2398 | return substring;
|
2399 | }).join("").match(formattingTokensRegExp).map(function (substring) {
|
2400 | if (substring === "''") {
|
2401 | return { isToken: false, value: "'" };
|
2402 | }
|
2403 | var firstCharacter = substring[0];
|
2404 | if (firstCharacter === "'") {
|
2405 | return { isToken: false, value: cleanEscapedString(substring) };
|
2406 | }
|
2407 | if (_formatters[firstCharacter]) {
|
2408 | return { isToken: true, value: substring };
|
2409 | }
|
2410 | if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
|
2411 | throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
|
2412 | }
|
2413 | return { isToken: false, value: substring };
|
2414 | });
|
2415 | if (locale.localize.preprocessor) {
|
2416 | parts = locale.localize.preprocessor(originalDate, parts);
|
2417 | }
|
2418 | var formatterOptions = {
|
2419 | firstWeekContainsDate: firstWeekContainsDate,
|
2420 | weekStartsOn: weekStartsOn,
|
2421 | locale: locale
|
2422 | };
|
2423 | return parts.map(function (part) {
|
2424 | if (!part.isToken)
|
2425 | return part.value;
|
2426 | var token = part.value;
|
2427 | if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token) || !(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {
|
2428 | warnOrThrowProtectedError(token, formatStr, String(date));
|
2429 | }
|
2430 | var formatter = _formatters[token[0]];
|
2431 | return formatter(originalDate, token, locale.localize, formatterOptions);
|
2432 | }).join("");
|
2433 | }
|
2434 | function cleanEscapedString(input) {
|
2435 | var matched = input.match(escapedStringRegExp);
|
2436 | if (!matched) {
|
2437 | return input;
|
2438 | }
|
2439 | return matched[1].replace(doubleQuoteRegExp, "'");
|
2440 | }
|
2441 | var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
2442 | var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
2443 | var escapedStringRegExp = /^'([^]*?)'?$/;
|
2444 | var doubleQuoteRegExp = /''/g;
|
2445 | var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
2446 |
|
2447 | function formatDistance3(laterDate, earlierDate, options) {var _ref20, _options$locale8;
|
2448 | var defaultOptions8 = getDefaultOptions();
|
2449 | var locale = (_ref20 = (_options$locale8 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale8 !== void 0 ? _options$locale8 : defaultOptions8.locale) !== null && _ref20 !== void 0 ? _ref20 : enUS;
|
2450 | var minutesInAlmostTwoDays = 2520;
|
2451 | var comparison = _compareAsc(laterDate, earlierDate);
|
2452 | if (isNaN(comparison))
|
2453 | throw new RangeError("Invalid time value");
|
2454 | var localizeOptions = Object.assign({}, options, {
|
2455 | addSuffix: options === null || options === void 0 ? void 0 : options.addSuffix,
|
2456 | comparison: comparison
|
2457 | });
|
2458 | var _normalizeDates35 = normalizeDates.apply(void 0, [options === null || options === void 0 ? void 0 : options.in].concat(_toConsumableArray(comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]))),_normalizeDates36 = _slicedToArray(_normalizeDates35, 2),laterDate_ = _normalizeDates36[0],earlierDate_ = _normalizeDates36[1];
|
2459 | var seconds = _differenceInSeconds(earlierDate_, laterDate_);
|
2460 | var offsetInSeconds = (getTimezoneOffsetInMilliseconds(earlierDate_) - getTimezoneOffsetInMilliseconds(laterDate_)) / 1000;
|
2461 | var minutes = Math.round((seconds - offsetInSeconds) / 60);
|
2462 | var months;
|
2463 | if (minutes < 2) {
|
2464 | if (options !== null && options !== void 0 && options.includeSeconds) {
|
2465 | if (seconds < 5) {
|
2466 | return locale.formatDistance("lessThanXSeconds", 5, localizeOptions);
|
2467 | } else if (seconds < 10) {
|
2468 | return locale.formatDistance("lessThanXSeconds", 10, localizeOptions);
|
2469 | } else if (seconds < 20) {
|
2470 | return locale.formatDistance("lessThanXSeconds", 20, localizeOptions);
|
2471 | } else if (seconds < 40) {
|
2472 | return locale.formatDistance("halfAMinute", 0, localizeOptions);
|
2473 | } else if (seconds < 60) {
|
2474 | return locale.formatDistance("lessThanXMinutes", 1, localizeOptions);
|
2475 | } else {
|
2476 | return locale.formatDistance("xMinutes", 1, localizeOptions);
|
2477 | }
|
2478 | } else {
|
2479 | if (minutes === 0) {
|
2480 | return locale.formatDistance("lessThanXMinutes", 1, localizeOptions);
|
2481 | } else {
|
2482 | return locale.formatDistance("xMinutes", minutes, localizeOptions);
|
2483 | }
|
2484 | }
|
2485 | } else if (minutes < 45) {
|
2486 | return locale.formatDistance("xMinutes", minutes, localizeOptions);
|
2487 | } else if (minutes < 90) {
|
2488 | return locale.formatDistance("aboutXHours", 1, localizeOptions);
|
2489 | } else if (minutes < minutesInDay) {
|
2490 | var hours = Math.round(minutes / 60);
|
2491 | return locale.formatDistance("aboutXHours", hours, localizeOptions);
|
2492 | } else if (minutes < minutesInAlmostTwoDays) {
|
2493 | return locale.formatDistance("xDays", 1, localizeOptions);
|
2494 | } else if (minutes < minutesInMonth) {
|
2495 | var _days = Math.round(minutes / minutesInDay);
|
2496 | return locale.formatDistance("xDays", _days, localizeOptions);
|
2497 | } else if (minutes < minutesInMonth * 2) {
|
2498 | months = Math.round(minutes / minutesInMonth);
|
2499 | return locale.formatDistance("aboutXMonths", months, localizeOptions);
|
2500 | }
|
2501 | months = _differenceInMonths(earlierDate_, laterDate_);
|
2502 | if (months < 12) {
|
2503 | var nearestMonth = Math.round(minutes / minutesInMonth);
|
2504 | return locale.formatDistance("xMonths", nearestMonth, localizeOptions);
|
2505 | } else {
|
2506 | var monthsSinceStartOfYear = months % 12;
|
2507 | var years = Math.trunc(months / 12);
|
2508 | if (monthsSinceStartOfYear < 3) {
|
2509 | return locale.formatDistance("aboutXYears", years, localizeOptions);
|
2510 | } else if (monthsSinceStartOfYear < 9) {
|
2511 | return locale.formatDistance("overXYears", years, localizeOptions);
|
2512 | } else {
|
2513 | return locale.formatDistance("almostXYears", years + 1, localizeOptions);
|
2514 | }
|
2515 | }
|
2516 | }
|
2517 |
|
2518 | function _formatDistanceStrict(laterDate, earlierDate, options) {var _ref21, _options$locale9, _options$roundingMeth;
|
2519 | var defaultOptions9 = getDefaultOptions();
|
2520 | var locale = (_ref21 = (_options$locale9 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale9 !== void 0 ? _options$locale9 : defaultOptions9.locale) !== null && _ref21 !== void 0 ? _ref21 : enUS;
|
2521 | var comparison = _compareAsc(laterDate, earlierDate);
|
2522 | if (isNaN(comparison)) {
|
2523 | throw new RangeError("Invalid time value");
|
2524 | }
|
2525 | var localizeOptions = Object.assign({}, options, {
|
2526 | addSuffix: options === null || options === void 0 ? void 0 : options.addSuffix,
|
2527 | comparison: comparison
|
2528 | });
|
2529 | var _normalizeDates37 = normalizeDates.apply(void 0, [options === null || options === void 0 ? void 0 : options.in].concat(_toConsumableArray(comparison > 0 ? [earlierDate, laterDate] : [laterDate, earlierDate]))),_normalizeDates38 = _slicedToArray(_normalizeDates37, 2),laterDate_ = _normalizeDates38[0],earlierDate_ = _normalizeDates38[1];
|
2530 | var roundingMethod = getRoundingMethod((_options$roundingMeth = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth !== void 0 ? _options$roundingMeth : "round");
|
2531 | var milliseconds = earlierDate_.getTime() - laterDate_.getTime();
|
2532 | var minutes = milliseconds / millisecondsInMinute;
|
2533 | var timezoneOffset = getTimezoneOffsetInMilliseconds(earlierDate_) - getTimezoneOffsetInMilliseconds(laterDate_);
|
2534 | var dstNormalizedMinutes = (milliseconds - timezoneOffset) / millisecondsInMinute;
|
2535 | var defaultUnit = options === null || options === void 0 ? void 0 : options.unit;
|
2536 | var unit;
|
2537 | if (!defaultUnit) {
|
2538 | if (minutes < 1) {
|
2539 | unit = "second";
|
2540 | } else if (minutes < 60) {
|
2541 | unit = "minute";
|
2542 | } else if (minutes < minutesInDay) {
|
2543 | unit = "hour";
|
2544 | } else if (dstNormalizedMinutes < minutesInMonth) {
|
2545 | unit = "day";
|
2546 | } else if (dstNormalizedMinutes < minutesInYear) {
|
2547 | unit = "month";
|
2548 | } else {
|
2549 | unit = "year";
|
2550 | }
|
2551 | } else {
|
2552 | unit = defaultUnit;
|
2553 | }
|
2554 | if (unit === "second") {
|
2555 | var seconds = roundingMethod(milliseconds / 1000);
|
2556 | return locale.formatDistance("xSeconds", seconds, localizeOptions);
|
2557 | } else if (unit === "minute") {
|
2558 | var roundedMinutes = roundingMethod(minutes);
|
2559 | return locale.formatDistance("xMinutes", roundedMinutes, localizeOptions);
|
2560 | } else if (unit === "hour") {
|
2561 | var hours = roundingMethod(minutes / 60);
|
2562 | return locale.formatDistance("xHours", hours, localizeOptions);
|
2563 | } else if (unit === "day") {
|
2564 | var _days2 = roundingMethod(dstNormalizedMinutes / minutesInDay);
|
2565 | return locale.formatDistance("xDays", _days2, localizeOptions);
|
2566 | } else if (unit === "month") {
|
2567 | var _months = roundingMethod(dstNormalizedMinutes / minutesInMonth);
|
2568 | return _months === 12 && defaultUnit !== "month" ? locale.formatDistance("xYears", 1, localizeOptions) : locale.formatDistance("xMonths", _months, localizeOptions);
|
2569 | } else {
|
2570 | var years = roundingMethod(dstNormalizedMinutes / minutesInYear);
|
2571 | return locale.formatDistance("xYears", years, localizeOptions);
|
2572 | }
|
2573 | }
|
2574 |
|
2575 | function _formatDistanceToNow(date, options) {
|
2576 | return formatDistance3(date, _constructNow(date), options);
|
2577 | }
|
2578 |
|
2579 | function _formatDistanceToNowStrict(date, options) {
|
2580 | return _formatDistanceStrict(date, _constructNow(date), options);
|
2581 | }
|
2582 |
|
2583 | function _formatDuration(duration, options) {var _ref22, _options$locale10, _options$format, _options$zero, _options$delimiter;
|
2584 | var defaultOptions10 = getDefaultOptions();
|
2585 | var locale = (_ref22 = (_options$locale10 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale10 !== void 0 ? _options$locale10 : defaultOptions10.locale) !== null && _ref22 !== void 0 ? _ref22 : enUS;
|
2586 | var format2 = (_options$format = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format !== void 0 ? _options$format : defaultFormat;
|
2587 | var zero = (_options$zero = options === null || options === void 0 ? void 0 : options.zero) !== null && _options$zero !== void 0 ? _options$zero : false;
|
2588 | var delimiter = (_options$delimiter = options === null || options === void 0 ? void 0 : options.delimiter) !== null && _options$delimiter !== void 0 ? _options$delimiter : " ";
|
2589 | if (!locale.formatDistance) {
|
2590 | return "";
|
2591 | }
|
2592 | var result = format2.reduce(function (acc, unit) {
|
2593 | var token = "x".concat(unit.replace(/(^.)/, function (m) {return m.toUpperCase();}));
|
2594 | var value = duration[unit];
|
2595 | if (value !== undefined && (zero || duration[unit])) {
|
2596 | return acc.concat(locale.formatDistance(token, value));
|
2597 | }
|
2598 | return acc;
|
2599 | }, []).join(delimiter);
|
2600 | return result;
|
2601 | }
|
2602 | var defaultFormat = [
|
2603 | "years",
|
2604 | "months",
|
2605 | "weeks",
|
2606 | "days",
|
2607 | "hours",
|
2608 | "minutes",
|
2609 | "seconds"];
|
2610 |
|
2611 |
|
2612 | function _formatISO2(date, options) {var _options$format2, _options$representati;
|
2613 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
2614 | if (isNaN(+date_)) {
|
2615 | throw new RangeError("Invalid time value");
|
2616 | }
|
2617 | var format2 = (_options$format2 = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format2 !== void 0 ? _options$format2 : "extended";
|
2618 | var representation = (_options$representati = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati !== void 0 ? _options$representati : "complete";
|
2619 | var result = "";
|
2620 | var tzOffset = "";
|
2621 | var dateDelimiter = format2 === "extended" ? "-" : "";
|
2622 | var timeDelimiter = format2 === "extended" ? ":" : "";
|
2623 | if (representation !== "time") {
|
2624 | var day = addLeadingZeros(date_.getDate(), 2);
|
2625 | var month = addLeadingZeros(date_.getMonth() + 1, 2);
|
2626 | var year = addLeadingZeros(date_.getFullYear(), 4);
|
2627 | result = "".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day);
|
2628 | }
|
2629 | if (representation !== "date") {
|
2630 | var offset = date_.getTimezoneOffset();
|
2631 | if (offset !== 0) {
|
2632 | var absoluteOffset = Math.abs(offset);
|
2633 | var hourOffset = addLeadingZeros(Math.trunc(absoluteOffset / 60), 2);
|
2634 | var minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);
|
2635 | var sign = offset < 0 ? "+" : "-";
|
2636 | tzOffset = "".concat(sign).concat(hourOffset, ":").concat(minuteOffset);
|
2637 | } else {
|
2638 | tzOffset = "Z";
|
2639 | }
|
2640 | var hour = addLeadingZeros(date_.getHours(), 2);
|
2641 | var minute = addLeadingZeros(date_.getMinutes(), 2);
|
2642 | var second = addLeadingZeros(date_.getSeconds(), 2);
|
2643 | var separator = result === "" ? "" : "T";
|
2644 | var time = [hour, minute, second].join(timeDelimiter);
|
2645 | result = "".concat(result).concat(separator).concat(time).concat(tzOffset);
|
2646 | }
|
2647 | return result;
|
2648 | }
|
2649 |
|
2650 | function _formatISO(date, options) {var _options$format3, _options$representati2;
|
2651 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
2652 | if (!_isValid(date_)) {
|
2653 | throw new RangeError("Invalid time value");
|
2654 | }
|
2655 | var format2 = (_options$format3 = options === null || options === void 0 ? void 0 : options.format) !== null && _options$format3 !== void 0 ? _options$format3 : "extended";
|
2656 | var representation = (_options$representati2 = options === null || options === void 0 ? void 0 : options.representation) !== null && _options$representati2 !== void 0 ? _options$representati2 : "complete";
|
2657 | var result = "";
|
2658 | var dateDelimiter = format2 === "extended" ? "-" : "";
|
2659 | var timeDelimiter = format2 === "extended" ? ":" : "";
|
2660 | if (representation !== "time") {
|
2661 | var day = addLeadingZeros(date_.getDate(), 2);
|
2662 | var month = addLeadingZeros(date_.getMonth() + 1, 2);
|
2663 | var year = addLeadingZeros(date_.getFullYear(), 4);
|
2664 | result = "".concat(year).concat(dateDelimiter).concat(month).concat(dateDelimiter).concat(day);
|
2665 | }
|
2666 | if (representation !== "date") {
|
2667 | var hour = addLeadingZeros(date_.getHours(), 2);
|
2668 | var minute = addLeadingZeros(date_.getMinutes(), 2);
|
2669 | var second = addLeadingZeros(date_.getSeconds(), 2);
|
2670 | var separator = result === "" ? "" : " ";
|
2671 | result = "".concat(result).concat(separator).concat(hour).concat(timeDelimiter).concat(minute).concat(timeDelimiter).concat(second);
|
2672 | }
|
2673 | return result;
|
2674 | }
|
2675 |
|
2676 | function _formatISODuration(duration) {
|
2677 | var _duration$years2 =
|
2678 |
|
2679 |
|
2680 |
|
2681 |
|
2682 |
|
2683 |
|
2684 | duration.years,years = _duration$years2 === void 0 ? 0 : _duration$years2,_duration$months2 = duration.months,months = _duration$months2 === void 0 ? 0 : _duration$months2,_duration$days2 = duration.days,days = _duration$days2 === void 0 ? 0 : _duration$days2,_duration$hours2 = duration.hours,hours = _duration$hours2 === void 0 ? 0 : _duration$hours2,_duration$minutes2 = duration.minutes,minutes = _duration$minutes2 === void 0 ? 0 : _duration$minutes2,_duration$seconds2 = duration.seconds,seconds = _duration$seconds2 === void 0 ? 0 : _duration$seconds2;
|
2685 | return "P".concat(years, "Y").concat(months, "M").concat(days, "DT").concat(hours, "H").concat(minutes, "M").concat(seconds, "S");
|
2686 | }
|
2687 |
|
2688 | function _formatRFC2(date, options) {var _options$fractionDigi;
|
2689 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
2690 | if (!_isValid(date_)) {
|
2691 | throw new RangeError("Invalid time value");
|
2692 | }
|
2693 | var fractionDigits = (_options$fractionDigi = options === null || options === void 0 ? void 0 : options.fractionDigits) !== null && _options$fractionDigi !== void 0 ? _options$fractionDigi : 0;
|
2694 | var day = addLeadingZeros(date_.getDate(), 2);
|
2695 | var month = addLeadingZeros(date_.getMonth() + 1, 2);
|
2696 | var year = date_.getFullYear();
|
2697 | var hour = addLeadingZeros(date_.getHours(), 2);
|
2698 | var minute = addLeadingZeros(date_.getMinutes(), 2);
|
2699 | var second = addLeadingZeros(date_.getSeconds(), 2);
|
2700 | var fractionalSecond = "";
|
2701 | if (fractionDigits > 0) {
|
2702 | var milliseconds = date_.getMilliseconds();
|
2703 | var fractionalSeconds = Math.trunc(milliseconds * Math.pow(10, fractionDigits - 3));
|
2704 | fractionalSecond = "." + addLeadingZeros(fractionalSeconds, fractionDigits);
|
2705 | }
|
2706 | var offset = "";
|
2707 | var tzOffset = date_.getTimezoneOffset();
|
2708 | if (tzOffset !== 0) {
|
2709 | var absoluteOffset = Math.abs(tzOffset);
|
2710 | var hourOffset = addLeadingZeros(Math.trunc(absoluteOffset / 60), 2);
|
2711 | var minuteOffset = addLeadingZeros(absoluteOffset % 60, 2);
|
2712 | var sign = tzOffset < 0 ? "+" : "-";
|
2713 | offset = "".concat(sign).concat(hourOffset, ":").concat(minuteOffset);
|
2714 | } else {
|
2715 | offset = "Z";
|
2716 | }
|
2717 | return "".concat(year, "-").concat(month, "-").concat(day, "T").concat(hour, ":").concat(minute, ":").concat(second).concat(fractionalSecond).concat(offset);
|
2718 | }
|
2719 |
|
2720 | function _formatRFC(date) {
|
2721 | var _date = _toDate(date);
|
2722 | if (!_isValid(_date)) {
|
2723 | throw new RangeError("Invalid time value");
|
2724 | }
|
2725 | var dayName = days[_date.getUTCDay()];
|
2726 | var dayOfMonth = addLeadingZeros(_date.getUTCDate(), 2);
|
2727 | var monthName = months[_date.getUTCMonth()];
|
2728 | var year = _date.getUTCFullYear();
|
2729 | var hour = addLeadingZeros(_date.getUTCHours(), 2);
|
2730 | var minute = addLeadingZeros(_date.getUTCMinutes(), 2);
|
2731 | var second = addLeadingZeros(_date.getUTCSeconds(), 2);
|
2732 | return "".concat(dayName, ", ").concat(dayOfMonth, " ").concat(monthName, " ").concat(year, " ").concat(hour, ":").concat(minute, ":").concat(second, " GMT");
|
2733 | }
|
2734 | var days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
2735 | var months = [
|
2736 | "Jan",
|
2737 | "Feb",
|
2738 | "Mar",
|
2739 | "Apr",
|
2740 | "May",
|
2741 | "Jun",
|
2742 | "Jul",
|
2743 | "Aug",
|
2744 | "Sep",
|
2745 | "Oct",
|
2746 | "Nov",
|
2747 | "Dec"];
|
2748 |
|
2749 |
|
2750 | function formatRelative3(date, baseDate, options) {var _ref23, _options$locale11, _ref24, _ref25, _ref26, _options$weekStartsOn4, _options$locale12, _defaultOptions11$loc;
|
2751 | var _normalizeDates39 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, date, baseDate),_normalizeDates40 = _slicedToArray(_normalizeDates39, 2),date_ = _normalizeDates40[0],baseDate_ = _normalizeDates40[1];
|
2752 | var defaultOptions11 = getDefaultOptions();
|
2753 | var locale = (_ref23 = (_options$locale11 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale11 !== void 0 ? _options$locale11 : defaultOptions11.locale) !== null && _ref23 !== void 0 ? _ref23 : enUS;
|
2754 | var weekStartsOn = (_ref24 = (_ref25 = (_ref26 = (_options$weekStartsOn4 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn4 !== void 0 ? _options$weekStartsOn4 : options === null || options === void 0 || (_options$locale12 = options.locale) === null || _options$locale12 === void 0 || (_options$locale12 = _options$locale12.options) === null || _options$locale12 === void 0 ? void 0 : _options$locale12.weekStartsOn) !== null && _ref26 !== void 0 ? _ref26 : defaultOptions11.weekStartsOn) !== null && _ref25 !== void 0 ? _ref25 : (_defaultOptions11$loc = defaultOptions11.locale) === null || _defaultOptions11$loc === void 0 || (_defaultOptions11$loc = _defaultOptions11$loc.options) === null || _defaultOptions11$loc === void 0 ? void 0 : _defaultOptions11$loc.weekStartsOn) !== null && _ref24 !== void 0 ? _ref24 : 0;
|
2755 | var diff = _differenceInCalendarDays(date_, baseDate_);
|
2756 | if (isNaN(diff)) {
|
2757 | throw new RangeError("Invalid time value");
|
2758 | }
|
2759 | var token;
|
2760 | if (diff < -6) {
|
2761 | token = "other";
|
2762 | } else if (diff < -1) {
|
2763 | token = "lastWeek";
|
2764 | } else if (diff < 0) {
|
2765 | token = "yesterday";
|
2766 | } else if (diff < 1) {
|
2767 | token = "today";
|
2768 | } else if (diff < 2) {
|
2769 | token = "tomorrow";
|
2770 | } else if (diff < 7) {
|
2771 | token = "nextWeek";
|
2772 | } else {
|
2773 | token = "other";
|
2774 | }
|
2775 | var formatStr = locale.formatRelative(token, date_, baseDate_, {
|
2776 | locale: locale,
|
2777 | weekStartsOn: weekStartsOn
|
2778 | });
|
2779 | return _format(date_, formatStr, { locale: locale, weekStartsOn: weekStartsOn });
|
2780 | }
|
2781 |
|
2782 | function _fromUnixTime(unixTime, options) {
|
2783 | return _toDate(unixTime * 1000, options === null || options === void 0 ? void 0 : options.in);
|
2784 | }
|
2785 |
|
2786 | function _getDate(date, options) {
|
2787 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDate();
|
2788 | }
|
2789 |
|
2790 | function _getDay(date, options) {
|
2791 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDay();
|
2792 | }
|
2793 |
|
2794 | function _getDaysInMonth(date, options) {
|
2795 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
2796 | var year = _date.getFullYear();
|
2797 | var monthIndex = _date.getMonth();
|
2798 | var lastDayOfMonth = _constructFrom(_date, 0);
|
2799 | lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
|
2800 | lastDayOfMonth.setHours(0, 0, 0, 0);
|
2801 | return lastDayOfMonth.getDate();
|
2802 | }
|
2803 |
|
2804 | function _isLeapYear(date, options) {
|
2805 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
2806 | var year = _date.getFullYear();
|
2807 | return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
2808 | }
|
2809 |
|
2810 |
|
2811 | function _getDaysInYear(date, options) {
|
2812 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
2813 | if (Number.isNaN(+_date))
|
2814 | return NaN;
|
2815 | return _isLeapYear(_date) ? 366 : 365;
|
2816 | }
|
2817 |
|
2818 | function _getDecade(date, options) {
|
2819 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
2820 | var year = _date.getFullYear();
|
2821 | var decade = Math.floor(year / 10) * 10;
|
2822 | return decade;
|
2823 | }
|
2824 |
|
2825 | function getDefaultOptions2() {
|
2826 | return Object.assign({}, getDefaultOptions());
|
2827 | }
|
2828 |
|
2829 | function _getHours(date, options) {
|
2830 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getHours();
|
2831 | }
|
2832 |
|
2833 | function _getISODay(date, options) {
|
2834 | var day = _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDay();
|
2835 | return day === 0 ? 7 : day;
|
2836 | }
|
2837 |
|
2838 | function _getISOWeeksInYear(date, options) {
|
2839 | var thisYear = _startOfISOWeekYear(date, options);
|
2840 | var nextYear = _startOfISOWeekYear(_addWeeks(thisYear, 60));
|
2841 | var diff = +nextYear - +thisYear;
|
2842 | return Math.round(diff / millisecondsInWeek);
|
2843 | }
|
2844 |
|
2845 | function _getMilliseconds(date) {
|
2846 | return _toDate(date).getMilliseconds();
|
2847 | }
|
2848 |
|
2849 | function _getMinutes(date, options) {
|
2850 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getMinutes();
|
2851 | }
|
2852 |
|
2853 | function _getMonth(date, options) {
|
2854 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getMonth();
|
2855 | }
|
2856 |
|
2857 | function _getOverlappingDaysInIntervals(intervalLeft, intervalRight) {
|
2858 | var _sort5 = [
|
2859 | +_toDate(intervalLeft.start),
|
2860 | +_toDate(intervalLeft.end)].
|
2861 | sort(function (a, b) {return a - b;}),_sort6 = _slicedToArray(_sort5, 2),leftStart = _sort6[0],leftEnd = _sort6[1];
|
2862 | var _sort7 = [
|
2863 | +_toDate(intervalRight.start),
|
2864 | +_toDate(intervalRight.end)].
|
2865 | sort(function (a, b) {return a - b;}),_sort8 = _slicedToArray(_sort7, 2),rightStart = _sort8[0],rightEnd = _sort8[1];
|
2866 | var isOverlapping = leftStart < rightEnd && rightStart < leftEnd;
|
2867 | if (!isOverlapping)
|
2868 | return 0;
|
2869 | var overlapLeft = rightStart < leftStart ? leftStart : rightStart;
|
2870 | var left = overlapLeft - getTimezoneOffsetInMilliseconds(overlapLeft);
|
2871 | var overlapRight = rightEnd > leftEnd ? leftEnd : rightEnd;
|
2872 | var right = overlapRight - getTimezoneOffsetInMilliseconds(overlapRight);
|
2873 | return Math.ceil((right - left) / millisecondsInDay);
|
2874 | }
|
2875 |
|
2876 | function _getSeconds(date) {
|
2877 | return _toDate(date).getSeconds();
|
2878 | }
|
2879 |
|
2880 | function _getTime(date) {
|
2881 | return +_toDate(date);
|
2882 | }
|
2883 |
|
2884 | function _getUnixTime(date) {
|
2885 | return Math.trunc(+_toDate(date) / 1000);
|
2886 | }
|
2887 |
|
2888 | function _getWeekOfMonth(date, options) {var _ref27, _ref28, _ref29, _options$weekStartsOn5, _options$locale13, _defaultOptions13$loc;
|
2889 | var defaultOptions13 = getDefaultOptions();
|
2890 | var weekStartsOn = (_ref27 = (_ref28 = (_ref29 = (_options$weekStartsOn5 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn5 !== void 0 ? _options$weekStartsOn5 : options === null || options === void 0 || (_options$locale13 = options.locale) === null || _options$locale13 === void 0 || (_options$locale13 = _options$locale13.options) === null || _options$locale13 === void 0 ? void 0 : _options$locale13.weekStartsOn) !== null && _ref29 !== void 0 ? _ref29 : defaultOptions13.weekStartsOn) !== null && _ref28 !== void 0 ? _ref28 : (_defaultOptions13$loc = defaultOptions13.locale) === null || _defaultOptions13$loc === void 0 || (_defaultOptions13$loc = _defaultOptions13$loc.options) === null || _defaultOptions13$loc === void 0 ? void 0 : _defaultOptions13$loc.weekStartsOn) !== null && _ref27 !== void 0 ? _ref27 : 0;
|
2891 | var currentDayOfMonth = _getDate(_toDate(date, options === null || options === void 0 ? void 0 : options.in));
|
2892 | if (isNaN(currentDayOfMonth))
|
2893 | return NaN;
|
2894 | var startWeekDay = _getDay(_startOfMonth(date, options));
|
2895 | var lastDayOfFirstWeek = weekStartsOn - startWeekDay;
|
2896 | if (lastDayOfFirstWeek <= 0)
|
2897 | lastDayOfFirstWeek += 7;
|
2898 | var remainingDaysAfterFirstWeek = currentDayOfMonth - lastDayOfFirstWeek;
|
2899 | return Math.ceil(remainingDaysAfterFirstWeek / 7) + 1;
|
2900 | }
|
2901 |
|
2902 | function _lastDayOfMonth(date, options) {
|
2903 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
2904 | var month = _date.getMonth();
|
2905 | _date.setFullYear(_date.getFullYear(), month + 1, 0);
|
2906 | _date.setHours(0, 0, 0, 0);
|
2907 | return _toDate(_date, options === null || options === void 0 ? void 0 : options.in);
|
2908 | }
|
2909 |
|
2910 |
|
2911 | function _getWeeksInMonth(date, options) {
|
2912 | var contextDate = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
2913 | return _differenceInCalendarWeeks(_lastDayOfMonth(contextDate, options), _startOfMonth(contextDate, options), options) + 1;
|
2914 | }
|
2915 |
|
2916 | function _getYear(date, options) {
|
2917 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getFullYear();
|
2918 | }
|
2919 |
|
2920 | function _hoursToMilliseconds(hours) {
|
2921 | return Math.trunc(hours * millisecondsInHour);
|
2922 | }
|
2923 |
|
2924 | function _hoursToMinutes(hours) {
|
2925 | return Math.trunc(hours * minutesInHour);
|
2926 | }
|
2927 |
|
2928 | function _hoursToSeconds(hours) {
|
2929 | return Math.trunc(hours * secondsInHour);
|
2930 | }
|
2931 |
|
2932 | function _interval(start, end, options) {
|
2933 | var _normalizeDates41 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, start, end),_normalizeDates42 = _slicedToArray(_normalizeDates41, 2),_start = _normalizeDates42[0],_end = _normalizeDates42[1];
|
2934 | if (isNaN(+_start))
|
2935 | throw new TypeError("Start date is invalid");
|
2936 | if (isNaN(+_end))
|
2937 | throw new TypeError("End date is invalid");
|
2938 | if (options !== null && options !== void 0 && options.assertPositive && +_start > +_end)
|
2939 | throw new TypeError("End date must be after start date");
|
2940 | return { start: _start, end: _end };
|
2941 | }
|
2942 |
|
2943 | function _intervalToDuration(interval2, options) {
|
2944 | var _normalizeInterval9 = normalizeInterval(options === null || options === void 0 ? void 0 : options.in, interval2),start = _normalizeInterval9.start,end = _normalizeInterval9.end;
|
2945 | var duration = {};
|
2946 | var years = _differenceInYears(end, start);
|
2947 | if (years)
|
2948 | duration.years = years;
|
2949 | var remainingMonths = _add(start, { years: duration.years });
|
2950 | var months2 = _differenceInMonths(end, remainingMonths);
|
2951 | if (months2)
|
2952 | duration.months = months2;
|
2953 | var remainingDays = _add(remainingMonths, { months: duration.months });
|
2954 | var days2 = _differenceInDays(end, remainingDays);
|
2955 | if (days2)
|
2956 | duration.days = days2;
|
2957 | var remainingHours = _add(remainingDays, { days: duration.days });
|
2958 | var hours = _differenceInHours(end, remainingHours);
|
2959 | if (hours)
|
2960 | duration.hours = hours;
|
2961 | var remainingMinutes = _add(remainingHours, { hours: duration.hours });
|
2962 | var minutes = _differenceInMinutes(end, remainingMinutes);
|
2963 | if (minutes)
|
2964 | duration.minutes = minutes;
|
2965 | var remainingSeconds = _add(remainingMinutes, { minutes: duration.minutes });
|
2966 | var seconds = _differenceInSeconds(end, remainingSeconds);
|
2967 | if (seconds)
|
2968 | duration.seconds = seconds;
|
2969 | return duration;
|
2970 | }
|
2971 |
|
2972 | function _intlFormat(date, formatOrLocale, localeOptions) {var _localeOptions;
|
2973 | var formatOptions;
|
2974 | if (isFormatOptions(formatOrLocale)) {
|
2975 | formatOptions = formatOrLocale;
|
2976 | } else {
|
2977 | localeOptions = formatOrLocale;
|
2978 | }
|
2979 | return new Intl.DateTimeFormat((_localeOptions = localeOptions) === null || _localeOptions === void 0 ? void 0 : _localeOptions.locale, formatOptions).format(_toDate(date));
|
2980 | }
|
2981 | function isFormatOptions(opts) {
|
2982 | return opts !== undefined && !("locale" in opts);
|
2983 | }
|
2984 |
|
2985 | function _intlFormatDistance(laterDate, earlierDate, options) {
|
2986 | var value = 0;
|
2987 | var unit;
|
2988 | var _normalizeDates43 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates44 = _slicedToArray(_normalizeDates43, 2),laterDate_ = _normalizeDates44[0],earlierDate_ = _normalizeDates44[1];
|
2989 | if (!(options !== null && options !== void 0 && options.unit)) {
|
2990 | var diffInSeconds = _differenceInSeconds(laterDate_, earlierDate_);
|
2991 | if (Math.abs(diffInSeconds) < secondsInMinute) {
|
2992 | value = _differenceInSeconds(laterDate_, earlierDate_);
|
2993 | unit = "second";
|
2994 | } else if (Math.abs(diffInSeconds) < secondsInHour) {
|
2995 | value = _differenceInMinutes(laterDate_, earlierDate_);
|
2996 | unit = "minute";
|
2997 | } else if (Math.abs(diffInSeconds) < secondsInDay && Math.abs(_differenceInCalendarDays(laterDate_, earlierDate_)) < 1) {
|
2998 | value = _differenceInHours(laterDate_, earlierDate_);
|
2999 | unit = "hour";
|
3000 | } else if (Math.abs(diffInSeconds) < secondsInWeek && (value = _differenceInCalendarDays(laterDate_, earlierDate_)) && Math.abs(value) < 7) {
|
3001 | unit = "day";
|
3002 | } else if (Math.abs(diffInSeconds) < secondsInMonth) {
|
3003 | value = _differenceInCalendarWeeks(laterDate_, earlierDate_);
|
3004 | unit = "week";
|
3005 | } else if (Math.abs(diffInSeconds) < secondsInQuarter) {
|
3006 | value = _differenceInCalendarMonths(laterDate_, earlierDate_);
|
3007 | unit = "month";
|
3008 | } else if (Math.abs(diffInSeconds) < secondsInYear) {
|
3009 | if (_differenceInCalendarQuarters(laterDate_, earlierDate_) < 4) {
|
3010 | value = _differenceInCalendarQuarters(laterDate_, earlierDate_);
|
3011 | unit = "quarter";
|
3012 | } else {
|
3013 | value = _differenceInCalendarYears(laterDate_, earlierDate_);
|
3014 | unit = "year";
|
3015 | }
|
3016 | } else {
|
3017 | value = _differenceInCalendarYears(laterDate_, earlierDate_);
|
3018 | unit = "year";
|
3019 | }
|
3020 | } else {
|
3021 | unit = options === null || options === void 0 ? void 0 : options.unit;
|
3022 | if (unit === "second") {
|
3023 | value = _differenceInSeconds(laterDate_, earlierDate_);
|
3024 | } else if (unit === "minute") {
|
3025 | value = _differenceInMinutes(laterDate_, earlierDate_);
|
3026 | } else if (unit === "hour") {
|
3027 | value = _differenceInHours(laterDate_, earlierDate_);
|
3028 | } else if (unit === "day") {
|
3029 | value = _differenceInCalendarDays(laterDate_, earlierDate_);
|
3030 | } else if (unit === "week") {
|
3031 | value = _differenceInCalendarWeeks(laterDate_, earlierDate_);
|
3032 | } else if (unit === "month") {
|
3033 | value = _differenceInCalendarMonths(laterDate_, earlierDate_);
|
3034 | } else if (unit === "quarter") {
|
3035 | value = _differenceInCalendarQuarters(laterDate_, earlierDate_);
|
3036 | } else if (unit === "year") {
|
3037 | value = _differenceInCalendarYears(laterDate_, earlierDate_);
|
3038 | }
|
3039 | }
|
3040 | var rtf = new Intl.RelativeTimeFormat(options === null || options === void 0 ? void 0 : options.locale, _objectSpread({
|
3041 | numeric: "auto" },
|
3042 | options)
|
3043 | );
|
3044 | return rtf.format(value, unit);
|
3045 | }
|
3046 |
|
3047 | function _isAfter(date, dateToCompare) {
|
3048 | return +_toDate(date) > +_toDate(dateToCompare);
|
3049 | }
|
3050 |
|
3051 | function _isBefore(date, dateToCompare) {
|
3052 | return +_toDate(date) < +_toDate(dateToCompare);
|
3053 | }
|
3054 |
|
3055 | function _isEqual(leftDate, rightDate) {
|
3056 | return +_toDate(leftDate) === +_toDate(rightDate);
|
3057 | }
|
3058 |
|
3059 | function _isExists(year, month, day) {
|
3060 | var date = new Date(year, month, day);
|
3061 | return date.getFullYear() === year && date.getMonth() === month && date.getDate() === day;
|
3062 | }
|
3063 |
|
3064 | function _isFirstDayOfMonth(date, options) {
|
3065 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDate() === 1;
|
3066 | }
|
3067 |
|
3068 | function _isFriday(date, options) {
|
3069 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDay() === 5;
|
3070 | }
|
3071 |
|
3072 | function _isFuture(date) {
|
3073 | return +_toDate(date) > Date.now();
|
3074 | }
|
3075 |
|
3076 | function _transpose(date, constructor) {
|
3077 | var date_ = isConstructor(constructor) ? new constructor(0) : _constructFrom(constructor, 0);
|
3078 | date_.setFullYear(date.getFullYear(), date.getMonth(), date.getDate());
|
3079 | date_.setHours(date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
|
3080 | return date_;
|
3081 | }
|
3082 | function isConstructor(constructor) {var _constructor$prototyp;
|
3083 | return typeof constructor === "function" && ((_constructor$prototyp = constructor.prototype) === null || _constructor$prototyp === void 0 ? void 0 : _constructor$prototyp.constructor) === constructor;
|
3084 | }
|
3085 |
|
3086 | // lib/parse/_lib/Setter.js
|
3087 | var TIMEZONE_UNIT_PRIORITY = 10;var
|
3088 |
|
3089 | Setter = /*#__PURE__*/function () {function Setter() {_classCallCheck(this, Setter);_defineProperty(this, "subPriority",
|
3090 | 0);}_createClass(Setter, [{ key: "validate", value:
|
3091 | function validate(_utcDate, _options) {
|
3092 | return true;
|
3093 | } }]);return Setter;}();var
|
3094 |
|
3095 |
|
3096 | ValueSetter = function (_Setter2) {_inherits(ValueSetter, _Setter2);
|
3097 | function ValueSetter(value, validateValue, setValue, priority, subPriority) {var _this;_classCallCheck(this, ValueSetter);
|
3098 | _this = _callSuper(this, ValueSetter);
|
3099 | _this.value = value;
|
3100 | _this.validateValue = validateValue;
|
3101 | _this.setValue = setValue;
|
3102 | _this.priority = priority;
|
3103 | if (subPriority) {
|
3104 | _this.subPriority = subPriority;
|
3105 | }return _this;
|
3106 | }_createClass(ValueSetter, [{ key: "validate", value:
|
3107 | function validate(date, options) {
|
3108 | return this.validateValue(date, this.value, options);
|
3109 | } }, { key: "set", value:
|
3110 | function set(date, flags, options) {
|
3111 | return this.setValue(date, flags, this.value, options);
|
3112 | } }]);return ValueSetter;}(Setter);var
|
3113 |
|
3114 |
|
3115 | DateTimezoneSetter = function (_Setter3) {_inherits(DateTimezoneSetter, _Setter3);
|
3116 |
|
3117 |
|
3118 | function DateTimezoneSetter(context, reference) {var _this2;_classCallCheck(this, DateTimezoneSetter);
|
3119 | _this2 = _callSuper(this, DateTimezoneSetter);_defineProperty(_assertThisInitialized(_this2), "priority", TIMEZONE_UNIT_PRIORITY);_defineProperty(_assertThisInitialized(_this2), "subPriority", -1);
|
3120 | _this2.context = context || function (date) {return _constructFrom(reference, date);};return _this2;
|
3121 | }_createClass(DateTimezoneSetter, [{ key: "set", value:
|
3122 | function set(date, flags) {
|
3123 | if (flags.timestampIsSet)
|
3124 | return date;
|
3125 | return _constructFrom(date, _transpose(date, this.context));
|
3126 | } }]);return DateTimezoneSetter;}(Setter);
|
3127 |
|
3128 |
|
3129 |
|
3130 | var Parser = function () {function Parser() {_classCallCheck(this, Parser);}_createClass(Parser, [{ key: "run", value:
|
3131 | function run(dateString, token, match3, options) {
|
3132 | var result = this.parse(dateString, token, match3, options);
|
3133 | if (!result) {
|
3134 | return null;
|
3135 | }
|
3136 | return {
|
3137 | setter: new ValueSetter(result.value, this.validate, this.set, this.priority, this.subPriority),
|
3138 | rest: result.rest
|
3139 | };
|
3140 | } }, { key: "validate", value:
|
3141 | function validate(_utcDate, _value, _options) {
|
3142 | return true;
|
3143 | } }]);return Parser;}();
|
3144 |
|
3145 |
|
3146 |
|
3147 | var EraParser = function (_Parser) {_inherits(EraParser, _Parser);function EraParser() {var _this3;_classCallCheck(this, EraParser);for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {args[_key2] = arguments[_key2];}_this3 = _callSuper(this, EraParser, [].concat(args));_defineProperty(_assertThisInitialized(_this3), "priority",
|
3148 | 140);_defineProperty(_assertThisInitialized(_this3), "incompatibleTokens",
|
3149 |
|
3150 |
|
3151 |
|
3152 |
|
3153 |
|
3154 |
|
3155 |
|
3156 |
|
3157 |
|
3158 |
|
3159 |
|
3160 |
|
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 |
|
3166 |
|
3167 |
|
3168 | ["R", "u", "t", "T"]);return _this3;}_createClass(EraParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "G":case "GG":case "GGG":return match3.era(dateString, { width: "abbreviated" }) || match3.era(dateString, { width: "narrow" });case "GGGGG":return match3.era(dateString, { width: "narrow" });case "GGGG":default:return match3.era(dateString, { width: "wide" }) || match3.era(dateString, { width: "abbreviated" }) || match3.era(dateString, { width: "narrow" });}} }, { key: "set", value: function set(date, flags, value) {flags.era = value;date.setFullYear(value, 0, 1);date.setHours(0, 0, 0, 0);return date;} }]);return EraParser;}(Parser);
|
3169 |
|
3170 |
|
3171 |
|
3172 | var numericPatterns = {
|
3173 | month: /^(1[0-2]|0?\d)/,
|
3174 | date: /^(3[0-1]|[0-2]?\d)/,
|
3175 | dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
|
3176 | week: /^(5[0-3]|[0-4]?\d)/,
|
3177 | hour23h: /^(2[0-3]|[0-1]?\d)/,
|
3178 | hour24h: /^(2[0-4]|[0-1]?\d)/,
|
3179 | hour11h: /^(1[0-1]|0?\d)/,
|
3180 | hour12h: /^(1[0-2]|0?\d)/,
|
3181 | minute: /^[0-5]?\d/,
|
3182 | second: /^[0-5]?\d/,
|
3183 | singleDigit: /^\d/,
|
3184 | twoDigits: /^\d{1,2}/,
|
3185 | threeDigits: /^\d{1,3}/,
|
3186 | fourDigits: /^\d{1,4}/,
|
3187 | anyDigitsSigned: /^-?\d+/,
|
3188 | singleDigitSigned: /^-?\d/,
|
3189 | twoDigitsSigned: /^-?\d{1,2}/,
|
3190 | threeDigitsSigned: /^-?\d{1,3}/,
|
3191 | fourDigitsSigned: /^-?\d{1,4}/
|
3192 | };
|
3193 | var timezonePatterns = {
|
3194 | basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
|
3195 | basic: /^([+-])(\d{2})(\d{2})|Z/,
|
3196 | basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
|
3197 | extended: /^([+-])(\d{2}):(\d{2})|Z/,
|
3198 | extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
|
3199 | };
|
3200 |
|
3201 |
|
3202 | function mapValue(parseFnResult, mapFn) {
|
3203 | if (!parseFnResult) {
|
3204 | return parseFnResult;
|
3205 | }
|
3206 | return {
|
3207 | value: mapFn(parseFnResult.value),
|
3208 | rest: parseFnResult.rest
|
3209 | };
|
3210 | }
|
3211 | function parseNumericPattern(pattern, dateString) {
|
3212 | var matchResult = dateString.match(pattern);
|
3213 | if (!matchResult) {
|
3214 | return null;
|
3215 | }
|
3216 | return {
|
3217 | value: parseInt(matchResult[0], 10),
|
3218 | rest: dateString.slice(matchResult[0].length)
|
3219 | };
|
3220 | }
|
3221 | function parseTimezonePattern(pattern, dateString) {
|
3222 | var matchResult = dateString.match(pattern);
|
3223 | if (!matchResult) {
|
3224 | return null;
|
3225 | }
|
3226 | if (matchResult[0] === "Z") {
|
3227 | return {
|
3228 | value: 0,
|
3229 | rest: dateString.slice(1)
|
3230 | };
|
3231 | }
|
3232 | var sign = matchResult[1] === "+" ? 1 : -1;
|
3233 | var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
|
3234 | var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
|
3235 | var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
|
3236 | return {
|
3237 | value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
|
3238 | rest: dateString.slice(matchResult[0].length)
|
3239 | };
|
3240 | }
|
3241 | function parseAnyDigitsSigned(dateString) {
|
3242 | return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
|
3243 | }
|
3244 | function parseNDigits(n, dateString) {
|
3245 | switch (n) {
|
3246 | case 1:
|
3247 | return parseNumericPattern(numericPatterns.singleDigit, dateString);
|
3248 | case 2:
|
3249 | return parseNumericPattern(numericPatterns.twoDigits, dateString);
|
3250 | case 3:
|
3251 | return parseNumericPattern(numericPatterns.threeDigits, dateString);
|
3252 | case 4:
|
3253 | return parseNumericPattern(numericPatterns.fourDigits, dateString);
|
3254 | default:
|
3255 | return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString);
|
3256 | }
|
3257 | }
|
3258 | function parseNDigitsSigned(n, dateString) {
|
3259 | switch (n) {
|
3260 | case 1:
|
3261 | return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
|
3262 | case 2:
|
3263 | return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
|
3264 | case 3:
|
3265 | return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
|
3266 | case 4:
|
3267 | return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
|
3268 | default:
|
3269 | return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString);
|
3270 | }
|
3271 | }
|
3272 | function dayPeriodEnumToHours(dayPeriod) {
|
3273 | switch (dayPeriod) {
|
3274 | case "morning":
|
3275 | return 4;
|
3276 | case "evening":
|
3277 | return 17;
|
3278 | case "pm":
|
3279 | case "noon":
|
3280 | case "afternoon":
|
3281 | return 12;
|
3282 | case "am":
|
3283 | case "midnight":
|
3284 | case "night":
|
3285 | default:
|
3286 | return 0;
|
3287 | }
|
3288 | }
|
3289 | function normalizeTwoDigitYear(twoDigitYear, currentYear) {
|
3290 | var isCommonEra = currentYear > 0;
|
3291 | var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
|
3292 | var result;
|
3293 | if (absCurrentYear <= 50) {
|
3294 | result = twoDigitYear || 100;
|
3295 | } else {
|
3296 | var rangeEnd = absCurrentYear + 50;
|
3297 | var rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
|
3298 | var isPreviousCentury = twoDigitYear >= rangeEnd % 100;
|
3299 | result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
|
3300 | }
|
3301 | return isCommonEra ? result : 1 - result;
|
3302 | }
|
3303 | function isLeapYearIndex(year) {
|
3304 | return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
3305 | }
|
3306 |
|
3307 |
|
3308 | var YearParser = function (_Parser2) {_inherits(YearParser, _Parser2);function YearParser() {var _this4;_classCallCheck(this, YearParser);for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {args[_key3] = arguments[_key3];}_this4 = _callSuper(this, YearParser, [].concat(args));_defineProperty(_assertThisInitialized(_this4), "priority",
|
3309 | 130);_defineProperty(_assertThisInitialized(_this4), "incompatibleTokens",
|
3310 | ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]);return _this4;}_createClass(YearParser, [{ key: "parse", value:
|
3311 | function parse(dateString, token, match3) {
|
3312 | var valueCallback = function valueCallback(year) {return {
|
3313 | year: year,
|
3314 | isTwoDigitYear: token === "yy"
|
3315 | };};
|
3316 | switch (token) {
|
3317 | case "y":
|
3318 | return mapValue(parseNDigits(4, dateString), valueCallback);
|
3319 | case "yo":
|
3320 | return mapValue(match3.ordinalNumber(dateString, {
|
3321 | unit: "year"
|
3322 | }), valueCallback);
|
3323 | default:
|
3324 | return mapValue(parseNDigits(token.length, dateString), valueCallback);
|
3325 | }
|
3326 | } }, { key: "validate", value:
|
3327 | function validate(_date, value) {
|
3328 | return value.isTwoDigitYear || value.year > 0;
|
3329 | } }, { key: "set", value:
|
3330 | function set(date, flags, value) {
|
3331 | var currentYear = date.getFullYear();
|
3332 | if (value.isTwoDigitYear) {
|
3333 | var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);
|
3334 | date.setFullYear(normalizedTwoDigitYear, 0, 1);
|
3335 | date.setHours(0, 0, 0, 0);
|
3336 | return date;
|
3337 | }
|
3338 | var year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
|
3339 | date.setFullYear(year, 0, 1);
|
3340 | date.setHours(0, 0, 0, 0);
|
3341 | return date;
|
3342 | } }]);return YearParser;}(Parser);
|
3343 |
|
3344 |
|
3345 |
|
3346 | var LocalWeekYearParser = function (_Parser3) {_inherits(LocalWeekYearParser, _Parser3);function LocalWeekYearParser() {var _this5;_classCallCheck(this, LocalWeekYearParser);for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {args[_key4] = arguments[_key4];}_this5 = _callSuper(this, LocalWeekYearParser, [].concat(args));_defineProperty(_assertThisInitialized(_this5), "priority",
|
3347 | 130);_defineProperty(_assertThisInitialized(_this5), "incompatibleTokens",
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 |
|
3353 |
|
3354 |
|
3355 |
|
3356 |
|
3357 |
|
3358 |
|
3359 |
|
3360 |
|
3361 |
|
3362 |
|
3363 |
|
3364 |
|
3365 |
|
3366 |
|
3367 |
|
3368 |
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 |
|
3378 |
|
3379 |
|
3380 | [
|
3381 | "y",
|
3382 | "R",
|
3383 | "u",
|
3384 | "Q",
|
3385 | "q",
|
3386 | "M",
|
3387 | "L",
|
3388 | "I",
|
3389 | "d",
|
3390 | "D",
|
3391 | "i",
|
3392 | "t",
|
3393 | "T"]);return _this5;}_createClass(LocalWeekYearParser, [{ key: "parse", value: function parse(dateString, token, match3) {var valueCallback = function valueCallback(year) {return { year: year, isTwoDigitYear: token === "YY" };};switch (token) {case "Y":return mapValue(parseNDigits(4, dateString), valueCallback);case "Yo":return mapValue(match3.ordinalNumber(dateString, { unit: "year" }), valueCallback);default:return mapValue(parseNDigits(token.length, dateString), valueCallback);}} }, { key: "validate", value: function validate(_date, value) {return value.isTwoDigitYear || value.year > 0;} }, { key: "set", value: function set(date, flags, value, options) {var currentYear = _getWeekYear(date, options);if (value.isTwoDigitYear) {var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);date.setFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);date.setHours(0, 0, 0, 0);return _startOfWeek(date, options);}var 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);} }]);return LocalWeekYearParser;}(Parser);
|
3394 |
|
3395 |
|
3396 |
|
3397 |
|
3398 | var ISOWeekYearParser = function (_Parser4) {_inherits(ISOWeekYearParser, _Parser4);function ISOWeekYearParser() {var _this6;_classCallCheck(this, ISOWeekYearParser);for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {args[_key5] = arguments[_key5];}_this6 = _callSuper(this, ISOWeekYearParser, [].concat(args));_defineProperty(_assertThisInitialized(_this6), "priority",
|
3399 | 130);_defineProperty(_assertThisInitialized(_this6), "incompatibleTokens",
|
3400 |
|
3401 |
|
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 |
|
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 | [
|
3413 | "G",
|
3414 | "y",
|
3415 | "Y",
|
3416 | "u",
|
3417 | "Q",
|
3418 | "q",
|
3419 | "M",
|
3420 | "L",
|
3421 | "w",
|
3422 | "d",
|
3423 | "D",
|
3424 | "e",
|
3425 | "c",
|
3426 | "t",
|
3427 | "T"]);return _this6;}_createClass(ISOWeekYearParser, [{ key: "parse", value: function parse(dateString, token) {if (token === "R") {return parseNDigitsSigned(4, dateString);}return parseNDigitsSigned(token.length, dateString);} }, { key: "set", value: function set(date, _flags, value) {var firstWeekOfYear = _constructFrom(date, 0);firstWeekOfYear.setFullYear(value, 0, 4);firstWeekOfYear.setHours(0, 0, 0, 0);return _startOfISOWeek(firstWeekOfYear);} }]);return ISOWeekYearParser;}(Parser);
|
3428 |
|
3429 |
|
3430 |
|
3431 |
|
3432 | var ExtendedYearParser = function (_Parser5) {_inherits(ExtendedYearParser, _Parser5);function ExtendedYearParser() {var _this7;_classCallCheck(this, ExtendedYearParser);for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {args[_key6] = arguments[_key6];}_this7 = _callSuper(this, ExtendedYearParser, [].concat(args));_defineProperty(_assertThisInitialized(_this7), "priority",
|
3433 | 130);_defineProperty(_assertThisInitialized(_this7), "incompatibleTokens",
|
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 |
|
3440 |
|
3441 |
|
3442 |
|
3443 |
|
3444 |
|
3445 | ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]);return _this7;}_createClass(ExtendedYearParser, [{ key: "parse", value: function parse(dateString, token) {if (token === "u") {return parseNDigitsSigned(4, dateString);}return parseNDigitsSigned(token.length, dateString);} }, { key: "set", value: function set(date, _flags, value) {date.setFullYear(value, 0, 1);date.setHours(0, 0, 0, 0);return date;} }]);return ExtendedYearParser;}(Parser);
|
3446 |
|
3447 |
|
3448 |
|
3449 | var QuarterParser = function (_Parser6) {_inherits(QuarterParser, _Parser6);function QuarterParser() {var _this8;_classCallCheck(this, QuarterParser);for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {args[_key7] = arguments[_key7];}_this8 = _callSuper(this, QuarterParser, [].concat(args));_defineProperty(_assertThisInitialized(_this8), "priority",
|
3450 | 120);_defineProperty(_assertThisInitialized(_this8), "incompatibleTokens",
|
3451 |
|
3452 |
|
3453 |
|
3454 |
|
3455 |
|
3456 |
|
3457 |
|
3458 |
|
3459 |
|
3460 |
|
3461 |
|
3462 |
|
3463 |
|
3464 |
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 |
|
3473 |
|
3474 |
|
3475 |
|
3476 |
|
3477 |
|
3478 |
|
3479 |
|
3480 |
|
3481 |
|
3482 |
|
3483 |
|
3484 |
|
3485 |
|
3486 |
|
3487 |
|
3488 |
|
3489 |
|
3490 |
|
3491 |
|
3492 |
|
3493 | [
|
3494 | "Y",
|
3495 | "R",
|
3496 | "q",
|
3497 | "M",
|
3498 | "L",
|
3499 | "w",
|
3500 | "I",
|
3501 | "d",
|
3502 | "D",
|
3503 | "i",
|
3504 | "e",
|
3505 | "c",
|
3506 | "t",
|
3507 | "T"]);return _this8;}_createClass(QuarterParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "Q":case "QQ":return parseNDigits(token.length, dateString);case "Qo":return match3.ordinalNumber(dateString, { unit: "quarter" });case "QQQ":return match3.quarter(dateString, { width: "abbreviated", context: "formatting" }) || match3.quarter(dateString, { width: "narrow", context: "formatting" });case "QQQQQ":return match3.quarter(dateString, { width: "narrow", context: "formatting" });case "QQQQ":default:return match3.quarter(dateString, { width: "wide", context: "formatting" }) || match3.quarter(dateString, { width: "abbreviated", context: "formatting" }) || match3.quarter(dateString, { width: "narrow", context: "formatting" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 4;} }, { key: "set", value: function set(date, _flags, value) {date.setMonth((value - 1) * 3, 1);date.setHours(0, 0, 0, 0);return date;} }]);return QuarterParser;}(Parser);
|
3508 |
|
3509 |
|
3510 |
|
3511 |
|
3512 | var StandAloneQuarterParser = function (_Parser7) {_inherits(StandAloneQuarterParser, _Parser7);function StandAloneQuarterParser() {var _this9;_classCallCheck(this, StandAloneQuarterParser);for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {args[_key8] = arguments[_key8];}_this9 = _callSuper(this, StandAloneQuarterParser, [].concat(args));_defineProperty(_assertThisInitialized(_this9), "priority",
|
3513 | 120);_defineProperty(_assertThisInitialized(_this9), "incompatibleTokens",
|
3514 |
|
3515 |
|
3516 |
|
3517 |
|
3518 |
|
3519 |
|
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 |
|
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 |
|
3536 |
|
3537 |
|
3538 |
|
3539 |
|
3540 |
|
3541 |
|
3542 |
|
3543 |
|
3544 |
|
3545 |
|
3546 |
|
3547 |
|
3548 |
|
3549 |
|
3550 |
|
3551 |
|
3552 |
|
3553 |
|
3554 |
|
3555 |
|
3556 | [
|
3557 | "Y",
|
3558 | "R",
|
3559 | "Q",
|
3560 | "M",
|
3561 | "L",
|
3562 | "w",
|
3563 | "I",
|
3564 | "d",
|
3565 | "D",
|
3566 | "i",
|
3567 | "e",
|
3568 | "c",
|
3569 | "t",
|
3570 | "T"]);return _this9;}_createClass(StandAloneQuarterParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "q":case "qq":return parseNDigits(token.length, dateString);case "qo":return match3.ordinalNumber(dateString, { unit: "quarter" });case "qqq":return match3.quarter(dateString, { width: "abbreviated", context: "standalone" }) || match3.quarter(dateString, { width: "narrow", context: "standalone" });case "qqqqq":return match3.quarter(dateString, { width: "narrow", context: "standalone" });case "qqqq":default:return match3.quarter(dateString, { width: "wide", context: "standalone" }) || match3.quarter(dateString, { width: "abbreviated", context: "standalone" }) || match3.quarter(dateString, { width: "narrow", context: "standalone" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 4;} }, { key: "set", value: function set(date, _flags, value) {date.setMonth((value - 1) * 3, 1);date.setHours(0, 0, 0, 0);return date;} }]);return StandAloneQuarterParser;}(Parser);
|
3571 |
|
3572 |
|
3573 |
|
3574 |
|
3575 | var MonthParser = function (_Parser8) {_inherits(MonthParser, _Parser8);function MonthParser() {var _this10;_classCallCheck(this, MonthParser);for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {args[_key9] = arguments[_key9];}_this10 = _callSuper(this, MonthParser, [].concat(args));_defineProperty(_assertThisInitialized(_this10), "incompatibleTokens",
|
3576 | [
|
3577 | "Y",
|
3578 | "R",
|
3579 | "q",
|
3580 | "Q",
|
3581 | "L",
|
3582 | "w",
|
3583 | "I",
|
3584 | "D",
|
3585 | "i",
|
3586 | "e",
|
3587 | "c",
|
3588 | "t",
|
3589 | "T"]);_defineProperty(_assertThisInitialized(_this10), "priority",
|
3590 |
|
3591 | 110);return _this10;}_createClass(MonthParser, [{ key: "parse", value:
|
3592 | function parse(dateString, token, match3) {
|
3593 | var valueCallback = function valueCallback(value) {return value - 1;};
|
3594 | switch (token) {
|
3595 | case "M":
|
3596 | return mapValue(parseNumericPattern(numericPatterns.month, dateString), valueCallback);
|
3597 | case "MM":
|
3598 | return mapValue(parseNDigits(2, dateString), valueCallback);
|
3599 | case "Mo":
|
3600 | return mapValue(match3.ordinalNumber(dateString, {
|
3601 | unit: "month"
|
3602 | }), valueCallback);
|
3603 | case "MMM":
|
3604 | return match3.month(dateString, {
|
3605 | width: "abbreviated",
|
3606 | context: "formatting"
|
3607 | }) || match3.month(dateString, { width: "narrow", context: "formatting" });
|
3608 | case "MMMMM":
|
3609 | return match3.month(dateString, {
|
3610 | width: "narrow",
|
3611 | context: "formatting"
|
3612 | });
|
3613 | case "MMMM":
|
3614 | default:
|
3615 | return match3.month(dateString, { width: "wide", context: "formatting" }) || match3.month(dateString, {
|
3616 | width: "abbreviated",
|
3617 | context: "formatting"
|
3618 | }) || match3.month(dateString, { width: "narrow", context: "formatting" });
|
3619 | }
|
3620 | } }, { key: "validate", value:
|
3621 | function validate(_date, value) {
|
3622 | return value >= 0 && value <= 11;
|
3623 | } }, { key: "set", value:
|
3624 | function set(date, _flags, value) {
|
3625 | date.setMonth(value, 1);
|
3626 | date.setHours(0, 0, 0, 0);
|
3627 | return date;
|
3628 | } }]);return MonthParser;}(Parser);
|
3629 |
|
3630 |
|
3631 |
|
3632 | var StandAloneMonthParser = function (_Parser9) {_inherits(StandAloneMonthParser, _Parser9);function StandAloneMonthParser() {var _this11;_classCallCheck(this, StandAloneMonthParser);for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {args[_key10] = arguments[_key10];}_this11 = _callSuper(this, StandAloneMonthParser, [].concat(args));_defineProperty(_assertThisInitialized(_this11), "priority",
|
3633 | 110);_defineProperty(_assertThisInitialized(_this11), "incompatibleTokens",
|
3634 |
|
3635 |
|
3636 |
|
3637 |
|
3638 |
|
3639 |
|
3640 |
|
3641 |
|
3642 |
|
3643 |
|
3644 |
|
3645 |
|
3646 |
|
3647 |
|
3648 |
|
3649 |
|
3650 |
|
3651 |
|
3652 |
|
3653 |
|
3654 |
|
3655 |
|
3656 |
|
3657 |
|
3658 |
|
3659 |
|
3660 |
|
3661 |
|
3662 |
|
3663 |
|
3664 |
|
3665 |
|
3666 |
|
3667 |
|
3668 |
|
3669 |
|
3670 |
|
3671 | [
|
3672 | "Y",
|
3673 | "R",
|
3674 | "q",
|
3675 | "Q",
|
3676 | "M",
|
3677 | "w",
|
3678 | "I",
|
3679 | "D",
|
3680 | "i",
|
3681 | "e",
|
3682 | "c",
|
3683 | "t",
|
3684 | "T"]);return _this11;}_createClass(StandAloneMonthParser, [{ key: "parse", value: function parse(dateString, token, match3) {var valueCallback = function valueCallback(value) {return 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(match3.ordinalNumber(dateString, { unit: "month" }), valueCallback);case "LLL":return match3.month(dateString, { width: "abbreviated", context: "standalone" }) || match3.month(dateString, { width: "narrow", context: "standalone" });case "LLLLL":return match3.month(dateString, { width: "narrow", context: "standalone" });case "LLLL":default:return match3.month(dateString, { width: "wide", context: "standalone" }) || match3.month(dateString, { width: "abbreviated", context: "standalone" }) || match3.month(dateString, { width: "narrow", context: "standalone" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 11;} }, { key: "set", value: function set(date, _flags, value) {date.setMonth(value, 1);date.setHours(0, 0, 0, 0);return date;} }]);return StandAloneMonthParser;}(Parser);
|
3685 |
|
3686 |
|
3687 |
|
3688 |
|
3689 | function _setWeek(date, week, options) {
|
3690 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
3691 | var diff = _getWeek(date_, options) - week;
|
3692 | date_.setDate(date_.getDate() - diff * 7);
|
3693 | return _toDate(date_, options === null || options === void 0 ? void 0 : options.in);
|
3694 | }
|
3695 |
|
3696 |
|
3697 | var LocalWeekParser = function (_Parser10) {_inherits(LocalWeekParser, _Parser10);function LocalWeekParser() {var _this12;_classCallCheck(this, LocalWeekParser);for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {args[_key11] = arguments[_key11];}_this12 = _callSuper(this, LocalWeekParser, [].concat(args));_defineProperty(_assertThisInitialized(_this12), "priority",
|
3698 | 100);_defineProperty(_assertThisInitialized(_this12), "incompatibleTokens",
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 |
|
3709 |
|
3710 |
|
3711 |
|
3712 |
|
3713 |
|
3714 |
|
3715 | [
|
3716 | "y",
|
3717 | "R",
|
3718 | "u",
|
3719 | "q",
|
3720 | "Q",
|
3721 | "M",
|
3722 | "L",
|
3723 | "I",
|
3724 | "d",
|
3725 | "D",
|
3726 | "i",
|
3727 | "t",
|
3728 | "T"]);return _this12;}_createClass(LocalWeekParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "w":return parseNumericPattern(numericPatterns.week, dateString);case "wo":return match3.ordinalNumber(dateString, { unit: "week" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 53;} }, { key: "set", value: function set(date, _flags, value, options) {return _startOfWeek(_setWeek(date, value, options), options);} }]);return LocalWeekParser;}(Parser);
|
3729 |
|
3730 |
|
3731 |
|
3732 |
|
3733 | function _setISOWeek(date, week, options) {
|
3734 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
3735 | var diff = _getISOWeek(_date, options) - week;
|
3736 | _date.setDate(_date.getDate() - diff * 7);
|
3737 | return _date;
|
3738 | }
|
3739 |
|
3740 |
|
3741 | var ISOWeekParser = function (_Parser11) {_inherits(ISOWeekParser, _Parser11);function ISOWeekParser() {var _this13;_classCallCheck(this, ISOWeekParser);for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {args[_key12] = arguments[_key12];}_this13 = _callSuper(this, ISOWeekParser, [].concat(args));_defineProperty(_assertThisInitialized(_this13), "priority",
|
3742 | 100);_defineProperty(_assertThisInitialized(_this13), "incompatibleTokens",
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 |
|
3750 |
|
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 |
|
3756 |
|
3757 |
|
3758 |
|
3759 | [
|
3760 | "y",
|
3761 | "Y",
|
3762 | "u",
|
3763 | "q",
|
3764 | "Q",
|
3765 | "M",
|
3766 | "L",
|
3767 | "w",
|
3768 | "d",
|
3769 | "D",
|
3770 | "e",
|
3771 | "c",
|
3772 | "t",
|
3773 | "T"]);return _this13;}_createClass(ISOWeekParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "I":return parseNumericPattern(numericPatterns.week, dateString);case "Io":return match3.ordinalNumber(dateString, { unit: "week" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 53;} }, { key: "set", value: function set(date, _flags, value) {return _startOfISOWeek(_setISOWeek(date, value));} }]);return ISOWeekParser;}(Parser);
|
3774 |
|
3775 |
|
3776 |
|
3777 |
|
3778 | var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
3779 | var DAYS_IN_MONTH_LEAP_YEAR = [
|
3780 | 31,
|
3781 | 29,
|
3782 | 31,
|
3783 | 30,
|
3784 | 31,
|
3785 | 30,
|
3786 | 31,
|
3787 | 31,
|
3788 | 30,
|
3789 | 31,
|
3790 | 30,
|
3791 | 31];var
|
3792 |
|
3793 |
|
3794 | DateParser = function (_Parser12) {_inherits(DateParser, _Parser12);function DateParser() {var _this14;_classCallCheck(this, DateParser);for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {args[_key13] = arguments[_key13];}_this14 = _callSuper(this, DateParser, [].concat(args));_defineProperty(_assertThisInitialized(_this14), "priority",
|
3795 | 90);_defineProperty(_assertThisInitialized(_this14), "subPriority",
|
3796 | 1);_defineProperty(_assertThisInitialized(_this14), "incompatibleTokens",
|
3797 |
|
3798 |
|
3799 |
|
3800 |
|
3801 |
|
3802 |
|
3803 |
|
3804 |
|
3805 |
|
3806 |
|
3807 |
|
3808 |
|
3809 |
|
3810 |
|
3811 |
|
3812 |
|
3813 |
|
3814 |
|
3815 |
|
3816 |
|
3817 |
|
3818 |
|
3819 |
|
3820 |
|
3821 |
|
3822 | [
|
3823 | "Y",
|
3824 | "R",
|
3825 | "q",
|
3826 | "Q",
|
3827 | "w",
|
3828 | "I",
|
3829 | "D",
|
3830 | "i",
|
3831 | "e",
|
3832 | "c",
|
3833 | "t",
|
3834 | "T"]);return _this14;}_createClass(DateParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "d":return parseNumericPattern(numericPatterns.date, dateString);case "do":return match3.ordinalNumber(dateString, { unit: "date" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(date, value) {var year = date.getFullYear();var isLeapYear3 = isLeapYearIndex(year);var month = date.getMonth();if (isLeapYear3) {return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];} else {return value >= 1 && value <= DAYS_IN_MONTH[month];}} }, { key: "set", value: function set(date, _flags, value) {date.setDate(value);date.setHours(0, 0, 0, 0);return date;} }]);return DateParser;}(Parser);
|
3835 |
|
3836 |
|
3837 |
|
3838 |
|
3839 | var DayOfYearParser = function (_Parser13) {_inherits(DayOfYearParser, _Parser13);function DayOfYearParser() {var _this15;_classCallCheck(this, DayOfYearParser);for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {args[_key14] = arguments[_key14];}_this15 = _callSuper(this, DayOfYearParser, [].concat(args));_defineProperty(_assertThisInitialized(_this15), "priority",
|
3840 | 90);_defineProperty(_assertThisInitialized(_this15), "subpriority",
|
3841 | 1);_defineProperty(_assertThisInitialized(_this15), "incompatibleTokens",
|
3842 |
|
3843 |
|
3844 |
|
3845 |
|
3846 |
|
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 |
|
3859 |
|
3860 |
|
3861 |
|
3862 |
|
3863 |
|
3864 |
|
3865 |
|
3866 |
|
3867 | [
|
3868 | "Y",
|
3869 | "R",
|
3870 | "q",
|
3871 | "Q",
|
3872 | "M",
|
3873 | "L",
|
3874 | "w",
|
3875 | "I",
|
3876 | "d",
|
3877 | "E",
|
3878 | "i",
|
3879 | "e",
|
3880 | "c",
|
3881 | "t",
|
3882 | "T"]);return _this15;}_createClass(DayOfYearParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "D":case "DD":return parseNumericPattern(numericPatterns.dayOfYear, dateString);case "Do":return match3.ordinalNumber(dateString, { unit: "date" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(date, value) {var year = date.getFullYear();var isLeapYear3 = isLeapYearIndex(year);if (isLeapYear3) {return value >= 1 && value <= 366;} else {return value >= 1 && value <= 365;}} }, { key: "set", value: function set(date, _flags, value) {date.setMonth(0, value);date.setHours(0, 0, 0, 0);return date;} }]);return DayOfYearParser;}(Parser);
|
3883 |
|
3884 |
|
3885 |
|
3886 |
|
3887 | function _setDay(date, day, options) {var _ref30, _ref31, _ref32, _options$weekStartsOn6, _options$locale14, _defaultOptions14$loc;
|
3888 | var defaultOptions14 = getDefaultOptions();
|
3889 | var weekStartsOn = (_ref30 = (_ref31 = (_ref32 = (_options$weekStartsOn6 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn6 !== void 0 ? _options$weekStartsOn6 : options === null || options === void 0 || (_options$locale14 = options.locale) === null || _options$locale14 === void 0 || (_options$locale14 = _options$locale14.options) === null || _options$locale14 === void 0 ? void 0 : _options$locale14.weekStartsOn) !== null && _ref32 !== void 0 ? _ref32 : defaultOptions14.weekStartsOn) !== null && _ref31 !== void 0 ? _ref31 : (_defaultOptions14$loc = defaultOptions14.locale) === null || _defaultOptions14$loc === void 0 || (_defaultOptions14$loc = _defaultOptions14$loc.options) === null || _defaultOptions14$loc === void 0 ? void 0 : _defaultOptions14$loc.weekStartsOn) !== null && _ref30 !== void 0 ? _ref30 : 0;
|
3890 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
3891 | var currentDay = date_.getDay();
|
3892 | var remainder = day % 7;
|
3893 | var dayIndex = (remainder + 7) % 7;
|
3894 | var delta = 7 - weekStartsOn;
|
3895 | var diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;
|
3896 | return _addDays(date_, diff, options);
|
3897 | }
|
3898 |
|
3899 |
|
3900 | var DayParser = function (_Parser14) {_inherits(DayParser, _Parser14);function DayParser() {var _this16;_classCallCheck(this, DayParser);for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {args[_key15] = arguments[_key15];}_this16 = _callSuper(this, DayParser, [].concat(args));_defineProperty(_assertThisInitialized(_this16), "priority",
|
3901 | 90);_defineProperty(_assertThisInitialized(_this16), "incompatibleTokens",
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 |
|
3908 |
|
3909 |
|
3910 |
|
3911 |
|
3912 |
|
3913 |
|
3914 |
|
3915 |
|
3916 |
|
3917 |
|
3918 |
|
3919 |
|
3920 |
|
3921 |
|
3922 |
|
3923 |
|
3924 |
|
3925 |
|
3926 |
|
3927 |
|
3928 |
|
3929 |
|
3930 |
|
3931 |
|
3932 |
|
3933 |
|
3934 | ["D", "i", "e", "c", "t", "T"]);return _this16;}_createClass(DayParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "E":case "EE":case "EEE":return match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });case "EEEEE":return match3.day(dateString, { width: "narrow", context: "formatting" });case "EEEEEE":return match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });case "EEEE":default:return match3.day(dateString, { width: "wide", context: "formatting" }) || match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 6;} }, { key: "set", value: function set(date, _flags, value, options) {date = _setDay(date, value, options);date.setHours(0, 0, 0, 0);return date;} }]);return DayParser;}(Parser);
|
3935 |
|
3936 |
|
3937 |
|
3938 | var LocalDayParser = function (_Parser15) {_inherits(LocalDayParser, _Parser15);function LocalDayParser() {var _this17;_classCallCheck(this, LocalDayParser);for (var _len16 = arguments.length, args = new Array(_len16), _key16 = 0; _key16 < _len16; _key16++) {args[_key16] = arguments[_key16];}_this17 = _callSuper(this, LocalDayParser, [].concat(args));_defineProperty(_assertThisInitialized(_this17), "priority",
|
3939 | 90);_defineProperty(_assertThisInitialized(_this17), "incompatibleTokens",
|
3940 |
|
3941 |
|
3942 |
|
3943 |
|
3944 |
|
3945 |
|
3946 |
|
3947 |
|
3948 |
|
3949 |
|
3950 |
|
3951 |
|
3952 |
|
3953 |
|
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 |
|
3963 |
|
3964 |
|
3965 |
|
3966 |
|
3967 |
|
3968 |
|
3969 |
|
3970 |
|
3971 |
|
3972 |
|
3973 |
|
3974 |
|
3975 |
|
3976 |
|
3977 |
|
3978 |
|
3979 |
|
3980 |
|
3981 | [
|
3982 | "y",
|
3983 | "R",
|
3984 | "u",
|
3985 | "q",
|
3986 | "Q",
|
3987 | "M",
|
3988 | "L",
|
3989 | "I",
|
3990 | "d",
|
3991 | "D",
|
3992 | "E",
|
3993 | "i",
|
3994 | "c",
|
3995 | "t",
|
3996 | "T"]);return _this17;}_createClass(LocalDayParser, [{ key: "parse", value: function parse(dateString, token, match3, options) {var valueCallback = function valueCallback(value) {var 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(match3.ordinalNumber(dateString, { unit: "day" }), valueCallback);case "eee":return match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });case "eeeee":return match3.day(dateString, { width: "narrow", context: "formatting" });case "eeeeee":return match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });case "eeee":default:return match3.day(dateString, { width: "wide", context: "formatting" }) || match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 6;} }, { key: "set", value: function set(date, _flags, value, options) {date = _setDay(date, value, options);date.setHours(0, 0, 0, 0);return date;} }]);return LocalDayParser;}(Parser);
|
3997 |
|
3998 |
|
3999 |
|
4000 |
|
4001 | var StandAloneLocalDayParser = function (_Parser16) {_inherits(StandAloneLocalDayParser, _Parser16);function StandAloneLocalDayParser() {var _this18;_classCallCheck(this, StandAloneLocalDayParser);for (var _len17 = arguments.length, args = new Array(_len17), _key17 = 0; _key17 < _len17; _key17++) {args[_key17] = arguments[_key17];}_this18 = _callSuper(this, StandAloneLocalDayParser, [].concat(args));_defineProperty(_assertThisInitialized(_this18), "priority",
|
4002 | 90);_defineProperty(_assertThisInitialized(_this18), "incompatibleTokens",
|
4003 |
|
4004 |
|
4005 |
|
4006 |
|
4007 |
|
4008 |
|
4009 |
|
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 |
|
4015 |
|
4016 |
|
4017 |
|
4018 |
|
4019 |
|
4020 |
|
4021 |
|
4022 |
|
4023 |
|
4024 |
|
4025 |
|
4026 |
|
4027 |
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 |
|
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 |
|
4041 |
|
4042 |
|
4043 |
|
4044 | [
|
4045 | "y",
|
4046 | "R",
|
4047 | "u",
|
4048 | "q",
|
4049 | "Q",
|
4050 | "M",
|
4051 | "L",
|
4052 | "I",
|
4053 | "d",
|
4054 | "D",
|
4055 | "E",
|
4056 | "i",
|
4057 | "e",
|
4058 | "t",
|
4059 | "T"]);return _this18;}_createClass(StandAloneLocalDayParser, [{ key: "parse", value: function parse(dateString, token, match3, options) {var valueCallback = function valueCallback(value) {var 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(match3.ordinalNumber(dateString, { unit: "day" }), valueCallback);case "ccc":return match3.day(dateString, { width: "abbreviated", context: "standalone" }) || match3.day(dateString, { width: "short", context: "standalone" }) || match3.day(dateString, { width: "narrow", context: "standalone" });case "ccccc":return match3.day(dateString, { width: "narrow", context: "standalone" });case "cccccc":return match3.day(dateString, { width: "short", context: "standalone" }) || match3.day(dateString, { width: "narrow", context: "standalone" });case "cccc":default:return match3.day(dateString, { width: "wide", context: "standalone" }) || match3.day(dateString, { width: "abbreviated", context: "standalone" }) || match3.day(dateString, { width: "short", context: "standalone" }) || match3.day(dateString, { width: "narrow", context: "standalone" });}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 6;} }, { key: "set", value: function set(date, _flags, value, options) {date = _setDay(date, value, options);date.setHours(0, 0, 0, 0);return date;} }]);return StandAloneLocalDayParser;}(Parser);
|
4060 |
|
4061 |
|
4062 |
|
4063 |
|
4064 | function _setISODay(date, day, options) {
|
4065 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
4066 | var currentDay = _getISODay(date_, options);
|
4067 | var diff = day - currentDay;
|
4068 | return _addDays(date_, diff, options);
|
4069 | }
|
4070 |
|
4071 |
|
4072 | var ISODayParser = function (_Parser17) {_inherits(ISODayParser, _Parser17);function ISODayParser() {var _this19;_classCallCheck(this, ISODayParser);for (var _len18 = arguments.length, args = new Array(_len18), _key18 = 0; _key18 < _len18; _key18++) {args[_key18] = arguments[_key18];}_this19 = _callSuper(this, ISODayParser, [].concat(args));_defineProperty(_assertThisInitialized(_this19), "priority",
|
4073 | 90);_defineProperty(_assertThisInitialized(_this19), "incompatibleTokens",
|
4074 |
|
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 |
|
4084 |
|
4085 |
|
4086 |
|
4087 |
|
4088 |
|
4089 |
|
4090 |
|
4091 |
|
4092 |
|
4093 |
|
4094 |
|
4095 |
|
4096 |
|
4097 |
|
4098 |
|
4099 |
|
4100 |
|
4101 |
|
4102 |
|
4103 |
|
4104 |
|
4105 |
|
4106 |
|
4107 |
|
4108 |
|
4109 |
|
4110 |
|
4111 |
|
4112 |
|
4113 |
|
4114 |
|
4115 |
|
4116 |
|
4117 |
|
4118 |
|
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 |
|
4125 |
|
4126 |
|
4127 |
|
4128 |
|
4129 |
|
4130 |
|
4131 |
|
4132 |
|
4133 |
|
4134 |
|
4135 |
|
4136 | [
|
4137 | "y",
|
4138 | "Y",
|
4139 | "u",
|
4140 | "q",
|
4141 | "Q",
|
4142 | "M",
|
4143 | "L",
|
4144 | "w",
|
4145 | "d",
|
4146 | "D",
|
4147 | "E",
|
4148 | "e",
|
4149 | "c",
|
4150 | "t",
|
4151 | "T"]);return _this19;}_createClass(ISODayParser, [{ key: "parse", value: function parse(dateString, token, match3) {var valueCallback = function valueCallback(value) {if (value === 0) {return 7;}return value;};switch (token) {case "i":case "ii":return parseNDigits(token.length, dateString);case "io":return match3.ordinalNumber(dateString, { unit: "day" });case "iii":return mapValue(match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" }), valueCallback);case "iiiii":return mapValue(match3.day(dateString, { width: "narrow", context: "formatting" }), valueCallback);case "iiiiii":return mapValue(match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" }), valueCallback);case "iiii":default:return mapValue(match3.day(dateString, { width: "wide", context: "formatting" }) || match3.day(dateString, { width: "abbreviated", context: "formatting" }) || match3.day(dateString, { width: "short", context: "formatting" }) || match3.day(dateString, { width: "narrow", context: "formatting" }), valueCallback);}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 7;} }, { key: "set", value: function set(date, _flags, value) {date = _setISODay(date, value);date.setHours(0, 0, 0, 0);return date;} }]);return ISODayParser;}(Parser);
|
4152 |
|
4153 |
|
4154 |
|
4155 |
|
4156 | var AMPMParser = function (_Parser18) {_inherits(AMPMParser, _Parser18);function AMPMParser() {var _this20;_classCallCheck(this, AMPMParser);for (var _len19 = arguments.length, args = new Array(_len19), _key19 = 0; _key19 < _len19; _key19++) {args[_key19] = arguments[_key19];}_this20 = _callSuper(this, AMPMParser, [].concat(args));_defineProperty(_assertThisInitialized(_this20), "priority",
|
4157 | 80);_defineProperty(_assertThisInitialized(_this20), "incompatibleTokens",
|
4158 |
|
4159 |
|
4160 |
|
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 |
|
4166 |
|
4167 |
|
4168 |
|
4169 |
|
4170 |
|
4171 |
|
4172 |
|
4173 |
|
4174 |
|
4175 |
|
4176 |
|
4177 |
|
4178 |
|
4179 |
|
4180 |
|
4181 |
|
4182 |
|
4183 |
|
4184 |
|
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 |
|
4191 |
|
4192 |
|
4193 | ["b", "B", "H", "k", "t", "T"]);return _this20;}_createClass(AMPMParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "a":case "aa":case "aaa":return match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "aaaaa":return match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "aaaa":default:return match3.dayPeriod(dateString, { width: "wide", context: "formatting" }) || match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });}} }, { key: "set", value: function set(date, _flags, value) {date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);return date;} }]);return AMPMParser;}(Parser);
|
4194 |
|
4195 |
|
4196 |
|
4197 | var AMPMMidnightParser = function (_Parser19) {_inherits(AMPMMidnightParser, _Parser19);function AMPMMidnightParser() {var _this21;_classCallCheck(this, AMPMMidnightParser);for (var _len20 = arguments.length, args = new Array(_len20), _key20 = 0; _key20 < _len20; _key20++) {args[_key20] = arguments[_key20];}_this21 = _callSuper(this, AMPMMidnightParser, [].concat(args));_defineProperty(_assertThisInitialized(_this21), "priority",
|
4198 | 80);_defineProperty(_assertThisInitialized(_this21), "incompatibleTokens",
|
4199 |
|
4200 |
|
4201 |
|
4202 |
|
4203 |
|
4204 |
|
4205 |
|
4206 |
|
4207 |
|
4208 |
|
4209 |
|
4210 |
|
4211 |
|
4212 |
|
4213 |
|
4214 |
|
4215 |
|
4216 |
|
4217 |
|
4218 |
|
4219 |
|
4220 |
|
4221 |
|
4222 |
|
4223 |
|
4224 |
|
4225 |
|
4226 |
|
4227 |
|
4228 |
|
4229 |
|
4230 |
|
4231 |
|
4232 |
|
4233 |
|
4234 | ["a", "B", "H", "k", "t", "T"]);return _this21;}_createClass(AMPMMidnightParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "b":case "bb":case "bbb":return match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "bbbbb":return match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "bbbb":default:return match3.dayPeriod(dateString, { width: "wide", context: "formatting" }) || match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });}} }, { key: "set", value: function set(date, _flags, value) {date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);return date;} }]);return AMPMMidnightParser;}(Parser);
|
4235 |
|
4236 |
|
4237 |
|
4238 | var DayPeriodParser = function (_Parser20) {_inherits(DayPeriodParser, _Parser20);function DayPeriodParser() {var _this22;_classCallCheck(this, DayPeriodParser);for (var _len21 = arguments.length, args = new Array(_len21), _key21 = 0; _key21 < _len21; _key21++) {args[_key21] = arguments[_key21];}_this22 = _callSuper(this, DayPeriodParser, [].concat(args));_defineProperty(_assertThisInitialized(_this22), "priority",
|
4239 | 80);_defineProperty(_assertThisInitialized(_this22), "incompatibleTokens",
|
4240 |
|
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 |
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
4257 |
|
4258 |
|
4259 |
|
4260 |
|
4261 |
|
4262 |
|
4263 |
|
4264 |
|
4265 |
|
4266 |
|
4267 |
|
4268 |
|
4269 |
|
4270 |
|
4271 |
|
4272 |
|
4273 |
|
4274 |
|
4275 | ["a", "b", "t", "T"]);return _this22;}_createClass(DayPeriodParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "B":case "BB":case "BBB":return match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "BBBBB":return match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });case "BBBB":default:return match3.dayPeriod(dateString, { width: "wide", context: "formatting" }) || match3.dayPeriod(dateString, { width: "abbreviated", context: "formatting" }) || match3.dayPeriod(dateString, { width: "narrow", context: "formatting" });}} }, { key: "set", value: function set(date, _flags, value) {date.setHours(dayPeriodEnumToHours(value), 0, 0, 0);return date;} }]);return DayPeriodParser;}(Parser);
|
4276 |
|
4277 |
|
4278 |
|
4279 | var Hour1to12Parser = function (_Parser21) {_inherits(Hour1to12Parser, _Parser21);function Hour1to12Parser() {var _this23;_classCallCheck(this, Hour1to12Parser);for (var _len22 = arguments.length, args = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {args[_key22] = arguments[_key22];}_this23 = _callSuper(this, Hour1to12Parser, [].concat(args));_defineProperty(_assertThisInitialized(_this23), "priority",
|
4280 | 70);_defineProperty(_assertThisInitialized(_this23), "incompatibleTokens",
|
4281 |
|
4282 |
|
4283 |
|
4284 |
|
4285 |
|
4286 |
|
4287 |
|
4288 |
|
4289 |
|
4290 |
|
4291 |
|
4292 |
|
4293 |
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 |
|
4299 |
|
4300 |
|
4301 |
|
4302 |
|
4303 |
|
4304 |
|
4305 | ["H", "K", "k", "t", "T"]);return _this23;}_createClass(Hour1to12Parser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "h":return parseNumericPattern(numericPatterns.hour12h, dateString);case "ho":return match3.ordinalNumber(dateString, { unit: "hour" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 12;} }, { key: "set", value: function set(date, _flags, value) {var 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;} }]);return Hour1to12Parser;}(Parser);
|
4306 |
|
4307 |
|
4308 |
|
4309 | var Hour0to23Parser = function (_Parser22) {_inherits(Hour0to23Parser, _Parser22);function Hour0to23Parser() {var _this24;_classCallCheck(this, Hour0to23Parser);for (var _len23 = arguments.length, args = new Array(_len23), _key23 = 0; _key23 < _len23; _key23++) {args[_key23] = arguments[_key23];}_this24 = _callSuper(this, Hour0to23Parser, [].concat(args));_defineProperty(_assertThisInitialized(_this24), "priority",
|
4310 | 70);_defineProperty(_assertThisInitialized(_this24), "incompatibleTokens",
|
4311 |
|
4312 |
|
4313 |
|
4314 |
|
4315 |
|
4316 |
|
4317 |
|
4318 |
|
4319 |
|
4320 |
|
4321 |
|
4322 |
|
4323 |
|
4324 |
|
4325 |
|
4326 |
|
4327 |
|
4328 | ["a", "b", "h", "K", "k", "t", "T"]);return _this24;}_createClass(Hour0to23Parser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "H":return parseNumericPattern(numericPatterns.hour23h, dateString);case "Ho":return match3.ordinalNumber(dateString, { unit: "hour" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 23;} }, { key: "set", value: function set(date, _flags, value) {date.setHours(value, 0, 0, 0);return date;} }]);return Hour0to23Parser;}(Parser);
|
4329 |
|
4330 |
|
4331 |
|
4332 | var Hour0To11Parser = function (_Parser23) {_inherits(Hour0To11Parser, _Parser23);function Hour0To11Parser() {var _this25;_classCallCheck(this, Hour0To11Parser);for (var _len24 = arguments.length, args = new Array(_len24), _key24 = 0; _key24 < _len24; _key24++) {args[_key24] = arguments[_key24];}_this25 = _callSuper(this, Hour0To11Parser, [].concat(args));_defineProperty(_assertThisInitialized(_this25), "priority",
|
4333 | 70);_defineProperty(_assertThisInitialized(_this25), "incompatibleTokens",
|
4334 |
|
4335 |
|
4336 |
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 |
|
4343 |
|
4344 |
|
4345 |
|
4346 |
|
4347 |
|
4348 |
|
4349 |
|
4350 |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 | ["h", "H", "k", "t", "T"]);return _this25;}_createClass(Hour0To11Parser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "K":return parseNumericPattern(numericPatterns.hour11h, dateString);case "Ko":return match3.ordinalNumber(dateString, { unit: "hour" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 11;} }, { key: "set", value: function set(date, _flags, value) {var isPM = date.getHours() >= 12;if (isPM && value < 12) {date.setHours(value + 12, 0, 0, 0);} else {date.setHours(value, 0, 0, 0);}return date;} }]);return Hour0To11Parser;}(Parser);
|
4357 |
|
4358 |
|
4359 |
|
4360 | var Hour1To24Parser = function (_Parser24) {_inherits(Hour1To24Parser, _Parser24);function Hour1To24Parser() {var _this26;_classCallCheck(this, Hour1To24Parser);for (var _len25 = arguments.length, args = new Array(_len25), _key25 = 0; _key25 < _len25; _key25++) {args[_key25] = arguments[_key25];}_this26 = _callSuper(this, Hour1To24Parser, [].concat(args));_defineProperty(_assertThisInitialized(_this26), "priority",
|
4361 | 70);_defineProperty(_assertThisInitialized(_this26), "incompatibleTokens",
|
4362 |
|
4363 |
|
4364 |
|
4365 |
|
4366 |
|
4367 |
|
4368 |
|
4369 |
|
4370 |
|
4371 |
|
4372 |
|
4373 |
|
4374 |
|
4375 |
|
4376 |
|
4377 |
|
4378 |
|
4379 |
|
4380 | ["a", "b", "h", "H", "K", "t", "T"]);return _this26;}_createClass(Hour1To24Parser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "k":return parseNumericPattern(numericPatterns.hour24h, dateString);case "ko":return match3.ordinalNumber(dateString, { unit: "hour" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 1 && value <= 24;} }, { key: "set", value: function set(date, _flags, value) {var hours = value <= 24 ? value % 24 : value;date.setHours(hours, 0, 0, 0);return date;} }]);return Hour1To24Parser;}(Parser);
|
4381 |
|
4382 |
|
4383 |
|
4384 | var MinuteParser = function (_Parser25) {_inherits(MinuteParser, _Parser25);function MinuteParser() {var _this27;_classCallCheck(this, MinuteParser);for (var _len26 = arguments.length, args = new Array(_len26), _key26 = 0; _key26 < _len26; _key26++) {args[_key26] = arguments[_key26];}_this27 = _callSuper(this, MinuteParser, [].concat(args));_defineProperty(_assertThisInitialized(_this27), "priority",
|
4385 | 60);_defineProperty(_assertThisInitialized(_this27), "incompatibleTokens",
|
4386 |
|
4387 |
|
4388 |
|
4389 |
|
4390 |
|
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 |
|
4396 |
|
4397 |
|
4398 |
|
4399 |
|
4400 |
|
4401 |
|
4402 |
|
4403 | ["t", "T"]);return _this27;}_createClass(MinuteParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "m":return parseNumericPattern(numericPatterns.minute, dateString);case "mo":return match3.ordinalNumber(dateString, { unit: "minute" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 59;} }, { key: "set", value: function set(date, _flags, value) {date.setMinutes(value, 0, 0);return date;} }]);return MinuteParser;}(Parser);
|
4404 |
|
4405 |
|
4406 |
|
4407 | var SecondParser = function (_Parser26) {_inherits(SecondParser, _Parser26);function SecondParser() {var _this28;_classCallCheck(this, SecondParser);for (var _len27 = arguments.length, args = new Array(_len27), _key27 = 0; _key27 < _len27; _key27++) {args[_key27] = arguments[_key27];}_this28 = _callSuper(this, SecondParser, [].concat(args));_defineProperty(_assertThisInitialized(_this28), "priority",
|
4408 | 50);_defineProperty(_assertThisInitialized(_this28), "incompatibleTokens",
|
4409 |
|
4410 |
|
4411 |
|
4412 |
|
4413 |
|
4414 |
|
4415 |
|
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 |
|
4421 |
|
4422 |
|
4423 |
|
4424 |
|
4425 |
|
4426 | ["t", "T"]);return _this28;}_createClass(SecondParser, [{ key: "parse", value: function parse(dateString, token, match3) {switch (token) {case "s":return parseNumericPattern(numericPatterns.second, dateString);case "so":return match3.ordinalNumber(dateString, { unit: "second" });default:return parseNDigits(token.length, dateString);}} }, { key: "validate", value: function validate(_date, value) {return value >= 0 && value <= 59;} }, { key: "set", value: function set(date, _flags, value) {date.setSeconds(value, 0);return date;} }]);return SecondParser;}(Parser);
|
4427 |
|
4428 |
|
4429 |
|
4430 | var FractionOfSecondParser = function (_Parser27) {_inherits(FractionOfSecondParser, _Parser27);function FractionOfSecondParser() {var _this29;_classCallCheck(this, FractionOfSecondParser);for (var _len28 = arguments.length, args = new Array(_len28), _key28 = 0; _key28 < _len28; _key28++) {args[_key28] = arguments[_key28];}_this29 = _callSuper(this, FractionOfSecondParser, [].concat(args));_defineProperty(_assertThisInitialized(_this29), "priority",
|
4431 | 30);_defineProperty(_assertThisInitialized(_this29), "incompatibleTokens",
|
4432 |
|
4433 |
|
4434 |
|
4435 |
|
4436 |
|
4437 |
|
4438 |
|
4439 |
|
4440 | ["t", "T"]);return _this29;}_createClass(FractionOfSecondParser, [{ key: "parse", value: function parse(dateString, token) {var valueCallback = function valueCallback(value) {return Math.trunc(value * Math.pow(10, -token.length + 3));};return mapValue(parseNDigits(token.length, dateString), valueCallback);} }, { key: "set", value: function set(date, _flags, value) {date.setMilliseconds(value);return date;} }]);return FractionOfSecondParser;}(Parser);
|
4441 |
|
4442 |
|
4443 |
|
4444 | var ISOTimezoneWithZParser = function (_Parser28) {_inherits(ISOTimezoneWithZParser, _Parser28);function ISOTimezoneWithZParser() {var _this30;_classCallCheck(this, ISOTimezoneWithZParser);for (var _len29 = arguments.length, args = new Array(_len29), _key29 = 0; _key29 < _len29; _key29++) {args[_key29] = arguments[_key29];}_this30 = _callSuper(this, ISOTimezoneWithZParser, [].concat(args));_defineProperty(_assertThisInitialized(_this30), "priority",
|
4445 | 10);_defineProperty(_assertThisInitialized(_this30), "incompatibleTokens",
|
4446 |
|
4447 |
|
4448 |
|
4449 |
|
4450 |
|
4451 |
|
4452 |
|
4453 |
|
4454 |
|
4455 |
|
4456 |
|
4457 |
|
4458 |
|
4459 |
|
4460 |
|
4461 |
|
4462 |
|
4463 |
|
4464 |
|
4465 |
|
4466 | ["t", "T", "x"]);return _this30;}_createClass(ISOTimezoneWithZParser, [{ key: "parse", value: function 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);}} }, { key: "set", value: function set(date, flags, value) {if (flags.timestampIsSet) return date;return _constructFrom(date, date.getTime() - getTimezoneOffsetInMilliseconds(date) - value);} }]);return ISOTimezoneWithZParser;}(Parser);
|
4467 |
|
4468 |
|
4469 |
|
4470 | var ISOTimezoneParser = function (_Parser29) {_inherits(ISOTimezoneParser, _Parser29);function ISOTimezoneParser() {var _this31;_classCallCheck(this, ISOTimezoneParser);for (var _len30 = arguments.length, args = new Array(_len30), _key30 = 0; _key30 < _len30; _key30++) {args[_key30] = arguments[_key30];}_this31 = _callSuper(this, ISOTimezoneParser, [].concat(args));_defineProperty(_assertThisInitialized(_this31), "priority",
|
4471 | 10);_defineProperty(_assertThisInitialized(_this31), "incompatibleTokens",
|
4472 |
|
4473 |
|
4474 |
|
4475 |
|
4476 |
|
4477 |
|
4478 |
|
4479 |
|
4480 |
|
4481 |
|
4482 |
|
4483 |
|
4484 |
|
4485 |
|
4486 |
|
4487 |
|
4488 |
|
4489 |
|
4490 |
|
4491 |
|
4492 | ["t", "T", "X"]);return _this31;}_createClass(ISOTimezoneParser, [{ key: "parse", value: function 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);}} }, { key: "set", value: function set(date, flags, value) {if (flags.timestampIsSet) return date;return _constructFrom(date, date.getTime() - getTimezoneOffsetInMilliseconds(date) - value);} }]);return ISOTimezoneParser;}(Parser);
|
4493 |
|
4494 |
|
4495 |
|
4496 | var TimestampSecondsParser = function (_Parser30) {_inherits(TimestampSecondsParser, _Parser30);function TimestampSecondsParser() {var _this32;_classCallCheck(this, TimestampSecondsParser);for (var _len31 = arguments.length, args = new Array(_len31), _key31 = 0; _key31 < _len31; _key31++) {args[_key31] = arguments[_key31];}_this32 = _callSuper(this, TimestampSecondsParser, [].concat(args));_defineProperty(_assertThisInitialized(_this32), "priority",
|
4497 | 40);_defineProperty(_assertThisInitialized(_this32), "incompatibleTokens",
|
4498 |
|
4499 |
|
4500 |
|
4501 |
|
4502 |
|
4503 |
|
4504 | "*");return _this32;}_createClass(TimestampSecondsParser, [{ key: "parse", value: function parse(dateString) {return parseAnyDigitsSigned(dateString);} }, { key: "set", value: function set(date, _flags, value) {return [_constructFrom(date, value * 1000), { timestampIsSet: true }];} }]);return TimestampSecondsParser;}(Parser);
|
4505 |
|
4506 |
|
4507 |
|
4508 | var TimestampMillisecondsParser = function (_Parser31) {_inherits(TimestampMillisecondsParser, _Parser31);function TimestampMillisecondsParser() {var _this33;_classCallCheck(this, TimestampMillisecondsParser);for (var _len32 = arguments.length, args = new Array(_len32), _key32 = 0; _key32 < _len32; _key32++) {args[_key32] = arguments[_key32];}_this33 = _callSuper(this, TimestampMillisecondsParser, [].concat(args));_defineProperty(_assertThisInitialized(_this33), "priority",
|
4509 | 20);_defineProperty(_assertThisInitialized(_this33), "incompatibleTokens",
|
4510 |
|
4511 |
|
4512 |
|
4513 |
|
4514 |
|
4515 |
|
4516 | "*");return _this33;}_createClass(TimestampMillisecondsParser, [{ key: "parse", value: function parse(dateString) {return parseAnyDigitsSigned(dateString);} }, { key: "set", value: function set(date, _flags, value) {return [_constructFrom(date, value), { timestampIsSet: true }];} }]);return TimestampMillisecondsParser;}(Parser);
|
4517 |
|
4518 |
|
4519 |
|
4520 | var _parsers = {
|
4521 | G: new EraParser(),
|
4522 | y: new YearParser(),
|
4523 | Y: new LocalWeekYearParser(),
|
4524 | R: new ISOWeekYearParser(),
|
4525 | u: new ExtendedYearParser(),
|
4526 | Q: new QuarterParser(),
|
4527 | q: new StandAloneQuarterParser(),
|
4528 | M: new MonthParser(),
|
4529 | L: new StandAloneMonthParser(),
|
4530 | w: new LocalWeekParser(),
|
4531 | I: new ISOWeekParser(),
|
4532 | d: new DateParser(),
|
4533 | D: new DayOfYearParser(),
|
4534 | E: new DayParser(),
|
4535 | e: new LocalDayParser(),
|
4536 | c: new StandAloneLocalDayParser(),
|
4537 | i: new ISODayParser(),
|
4538 | a: new AMPMParser(),
|
4539 | b: new AMPMMidnightParser(),
|
4540 | B: new DayPeriodParser(),
|
4541 | h: new Hour1to12Parser(),
|
4542 | H: new Hour0to23Parser(),
|
4543 | K: new Hour0To11Parser(),
|
4544 | k: new Hour1To24Parser(),
|
4545 | m: new MinuteParser(),
|
4546 | s: new SecondParser(),
|
4547 | S: new FractionOfSecondParser(),
|
4548 | X: new ISOTimezoneWithZParser(),
|
4549 | x: new ISOTimezoneParser(),
|
4550 | t: new TimestampSecondsParser(),
|
4551 | T: new TimestampMillisecondsParser()
|
4552 | };
|
4553 |
|
4554 |
|
4555 | function _parse(dateStr, formatStr, referenceDate, options) {var _ref33, _options$locale15, _ref34, _ref35, _ref36, _options$firstWeekCon4, _options$locale16, _defaultOptions14$loc2, _ref37, _ref38, _ref39, _options$weekStartsOn7, _options$locale17, _defaultOptions14$loc3;
|
4556 | var invalidDate = function invalidDate() {return _constructFrom((options === null || options === void 0 ? void 0 : options.in) || referenceDate, NaN);};
|
4557 | var defaultOptions14 = getDefaultOptions2();
|
4558 | var locale = (_ref33 = (_options$locale15 = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale15 !== void 0 ? _options$locale15 : defaultOptions14.locale) !== null && _ref33 !== void 0 ? _ref33 : enUS;
|
4559 | var firstWeekContainsDate = (_ref34 = (_ref35 = (_ref36 = (_options$firstWeekCon4 = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon4 !== void 0 ? _options$firstWeekCon4 : options === null || options === void 0 || (_options$locale16 = options.locale) === null || _options$locale16 === void 0 || (_options$locale16 = _options$locale16.options) === null || _options$locale16 === void 0 ? void 0 : _options$locale16.firstWeekContainsDate) !== null && _ref36 !== void 0 ? _ref36 : defaultOptions14.firstWeekContainsDate) !== null && _ref35 !== void 0 ? _ref35 : (_defaultOptions14$loc2 = defaultOptions14.locale) === null || _defaultOptions14$loc2 === void 0 || (_defaultOptions14$loc2 = _defaultOptions14$loc2.options) === null || _defaultOptions14$loc2 === void 0 ? void 0 : _defaultOptions14$loc2.firstWeekContainsDate) !== null && _ref34 !== void 0 ? _ref34 : 1;
|
4560 | var weekStartsOn = (_ref37 = (_ref38 = (_ref39 = (_options$weekStartsOn7 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn7 !== void 0 ? _options$weekStartsOn7 : options === null || options === void 0 || (_options$locale17 = options.locale) === null || _options$locale17 === void 0 || (_options$locale17 = _options$locale17.options) === null || _options$locale17 === void 0 ? void 0 : _options$locale17.weekStartsOn) !== null && _ref39 !== void 0 ? _ref39 : defaultOptions14.weekStartsOn) !== null && _ref38 !== void 0 ? _ref38 : (_defaultOptions14$loc3 = defaultOptions14.locale) === null || _defaultOptions14$loc3 === void 0 || (_defaultOptions14$loc3 = _defaultOptions14$loc3.options) === null || _defaultOptions14$loc3 === void 0 ? void 0 : _defaultOptions14$loc3.weekStartsOn) !== null && _ref37 !== void 0 ? _ref37 : 0;
|
4561 | if (!formatStr)
|
4562 | return dateStr ? invalidDate() : _toDate(referenceDate, options === null || options === void 0 ? void 0 : options.in);
|
4563 | var subFnOptions = {
|
4564 | firstWeekContainsDate: firstWeekContainsDate,
|
4565 | weekStartsOn: weekStartsOn,
|
4566 | locale: locale
|
4567 | };
|
4568 | var setters = [new DateTimezoneSetter(options === null || options === void 0 ? void 0 : options.in, referenceDate)];
|
4569 | var tokens = formatStr.match(longFormattingTokensRegExp2).map(function (substring) {
|
4570 | var firstCharacter = substring[0];
|
4571 | if (firstCharacter in _longFormatters) {
|
4572 | var longFormatter = _longFormatters[firstCharacter];
|
4573 | return longFormatter(substring, locale.formatLong);
|
4574 | }
|
4575 | return substring;
|
4576 | }).join("").match(formattingTokensRegExp2);
|
4577 | var usedTokens = [];var _iterator = _createForOfIteratorHelper(
|
4578 | tokens),_step;try {var _loop = function _loop() {var token = _step.value;
|
4579 | if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token)) {
|
4580 | warnOrThrowProtectedError(token, formatStr, dateStr);
|
4581 | }
|
4582 | if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {
|
4583 | warnOrThrowProtectedError(token, formatStr, dateStr);
|
4584 | }
|
4585 | var firstCharacter = token[0];
|
4586 | var parser = _parsers[firstCharacter];
|
4587 | if (parser) {
|
4588 | var incompatibleTokens = parser.incompatibleTokens;
|
4589 | if (Array.isArray(incompatibleTokens)) {
|
4590 | var incompatibleToken = usedTokens.find(function (usedToken) {return incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter;});
|
4591 | if (incompatibleToken) {
|
4592 | throw new RangeError("The format string mustn't contain `".concat(incompatibleToken.fullToken, "` and `").concat(token, "` at the same time"));
|
4593 | }
|
4594 | } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) {
|
4595 | throw new RangeError("The format string mustn't contain `".concat(token, "` and any other token at the same time"));
|
4596 | }
|
4597 | usedTokens.push({ token: firstCharacter, fullToken: token });
|
4598 | var parseResult = parser.run(dateStr, token, locale.match, subFnOptions);
|
4599 | if (!parseResult) {return { v:
|
4600 | invalidDate() };
|
4601 | }
|
4602 | setters.push(parseResult.setter);
|
4603 | dateStr = parseResult.rest;
|
4604 | } else {
|
4605 | if (firstCharacter.match(unescapedLatinCharacterRegExp2)) {
|
4606 | throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
|
4607 | }
|
4608 | if (token === "''") {
|
4609 | token = "'";
|
4610 | } else if (firstCharacter === "'") {
|
4611 | token = cleanEscapedString2(token);
|
4612 | }
|
4613 | if (dateStr.indexOf(token) === 0) {
|
4614 | dateStr = dateStr.slice(token.length);
|
4615 | } else {return { v:
|
4616 | invalidDate() };
|
4617 | }
|
4618 | }
|
4619 | },_ret;for (_iterator.s(); !(_step = _iterator.n()).done;) {_ret = _loop();if (_ret) return _ret.v;}} catch (err) {_iterator.e(err);} finally {_iterator.f();}
|
4620 | if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) {
|
4621 | return invalidDate();
|
4622 | }
|
4623 | var uniquePrioritySetters = setters.map(function (setter) {return setter.priority;}).sort(function (a, b) {return b - a;}).filter(function (priority, index, array) {return array.indexOf(priority) === index;}).map(function (priority) {return setters.filter(function (setter) {return setter.priority === priority;}).sort(function (a, b) {return b.subPriority - a.subPriority;});}).map(function (setterArray) {return setterArray[0];});
|
4624 | var date = _toDate(referenceDate, options === null || options === void 0 ? void 0 : options.in);
|
4625 | if (isNaN(+date))
|
4626 | return invalidDate();
|
4627 | var flags = {};var _iterator2 = _createForOfIteratorHelper(
|
4628 | uniquePrioritySetters),_step2;try {for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {var setter = _step2.value;
|
4629 | if (!setter.validate(date, subFnOptions)) {
|
4630 | return invalidDate();
|
4631 | }
|
4632 | var result = setter.set(date, flags, subFnOptions);
|
4633 | if (Array.isArray(result)) {
|
4634 | date = result[0];
|
4635 | Object.assign(flags, result[1]);
|
4636 | } else {
|
4637 | date = result;
|
4638 | }
|
4639 | }} catch (err) {_iterator2.e(err);} finally {_iterator2.f();}
|
4640 | return date;
|
4641 | }
|
4642 | function cleanEscapedString2(input) {
|
4643 | return input.match(escapedStringRegExp2)[1].replace(doubleQuoteRegExp2, "'");
|
4644 | }
|
4645 | var formattingTokensRegExp2 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
4646 | var longFormattingTokensRegExp2 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
4647 | var escapedStringRegExp2 = /^'([^]*?)'?$/;
|
4648 | var doubleQuoteRegExp2 = /''/g;
|
4649 | var notWhitespaceRegExp = /\S/;
|
4650 | var unescapedLatinCharacterRegExp2 = /[a-zA-Z]/;
|
4651 |
|
4652 |
|
4653 | function _isMatch(dateStr, formatStr, options) {
|
4654 | return _isValid(_parse(dateStr, formatStr, new Date(), options));
|
4655 | }
|
4656 |
|
4657 | function _isMonday(date, options) {
|
4658 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDay() === 1;
|
4659 | }
|
4660 |
|
4661 | function _isPast(date) {
|
4662 | return +_toDate(date) < Date.now();
|
4663 | }
|
4664 |
|
4665 | function _startOfHour(date, options) {
|
4666 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
4667 | _date.setMinutes(0, 0, 0);
|
4668 | return _date;
|
4669 | }
|
4670 |
|
4671 |
|
4672 | function _isSameHour(dateLeft, dateRight, options) {
|
4673 | var _normalizeDates45 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, dateLeft, dateRight),_normalizeDates46 = _slicedToArray(_normalizeDates45, 2),dateLeft_ = _normalizeDates46[0],dateRight_ = _normalizeDates46[1];
|
4674 | return +_startOfHour(dateLeft_) === +_startOfHour(dateRight_);
|
4675 | }
|
4676 |
|
4677 | function _isSameWeek(laterDate, earlierDate, options) {
|
4678 | var _normalizeDates47 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates48 = _slicedToArray(_normalizeDates47, 2),laterDate_ = _normalizeDates48[0],earlierDate_ = _normalizeDates48[1];
|
4679 | return +_startOfWeek(laterDate_, options) === +_startOfWeek(earlierDate_, options);
|
4680 | }
|
4681 |
|
4682 |
|
4683 | function _isSameISOWeek(laterDate, earlierDate, options) {
|
4684 | return _isSameWeek(laterDate, earlierDate, _objectSpread(_objectSpread({}, options), {}, { weekStartsOn: 1 }));
|
4685 | }
|
4686 |
|
4687 | function _isSameISOWeekYear(laterDate, earlierDate, options) {
|
4688 | var _normalizeDates49 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates50 = _slicedToArray(_normalizeDates49, 2),laterDate_ = _normalizeDates50[0],earlierDate_ = _normalizeDates50[1];
|
4689 | return +_startOfISOWeekYear(laterDate_) === +_startOfISOWeekYear(earlierDate_);
|
4690 | }
|
4691 |
|
4692 | function _startOfMinute(date, options) {
|
4693 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
4694 | date_.setSeconds(0, 0);
|
4695 | return date_;
|
4696 | }
|
4697 |
|
4698 |
|
4699 | function _isSameMinute(laterDate, earlierDate) {
|
4700 | return +_startOfMinute(laterDate) === +_startOfMinute(earlierDate);
|
4701 | }
|
4702 |
|
4703 | function _isSameMonth(laterDate, earlierDate, options) {
|
4704 | var _normalizeDates51 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates52 = _slicedToArray(_normalizeDates51, 2),laterDate_ = _normalizeDates52[0],earlierDate_ = _normalizeDates52[1];
|
4705 | return laterDate_.getFullYear() === earlierDate_.getFullYear() && laterDate_.getMonth() === earlierDate_.getMonth();
|
4706 | }
|
4707 |
|
4708 | function _isSameQuarter(laterDate, earlierDate, options) {
|
4709 | var _normalizeDates53 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates54 = _slicedToArray(_normalizeDates53, 2),dateLeft_ = _normalizeDates54[0],dateRight_ = _normalizeDates54[1];
|
4710 | return +_startOfQuarter(dateLeft_) === +_startOfQuarter(dateRight_);
|
4711 | }
|
4712 |
|
4713 | function _startOfSecond(date, options) {
|
4714 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
4715 | date_.setMilliseconds(0);
|
4716 | return date_;
|
4717 | }
|
4718 |
|
4719 |
|
4720 | function _isSameSecond(laterDate, earlierDate) {
|
4721 | return +_startOfSecond(laterDate) === +_startOfSecond(earlierDate);
|
4722 | }
|
4723 |
|
4724 | function _isSameYear(laterDate, earlierDate, options) {
|
4725 | var _normalizeDates55 = normalizeDates(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate),_normalizeDates56 = _slicedToArray(_normalizeDates55, 2),laterDate_ = _normalizeDates56[0],earlierDate_ = _normalizeDates56[1];
|
4726 | return laterDate_.getFullYear() === earlierDate_.getFullYear();
|
4727 | }
|
4728 |
|
4729 | function _isThisHour(date, options) {
|
4730 | return _isSameHour(_toDate(date, options === null || options === void 0 ? void 0 : options.in), _constructNow((options === null || options === void 0 ? void 0 : options.in) || date));
|
4731 | }
|
4732 |
|
4733 | function _isThisISOWeek(date, options) {
|
4734 | return _isSameISOWeek(_constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, date), _constructNow((options === null || options === void 0 ? void 0 : options.in) || date));
|
4735 | }
|
4736 |
|
4737 | function _isThisMinute(date) {
|
4738 | return _isSameMinute(date, _constructNow(date));
|
4739 | }
|
4740 |
|
4741 | function _isThisMonth(date, options) {
|
4742 | return _isSameMonth(_constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, date), _constructNow((options === null || options === void 0 ? void 0 : options.in) || date));
|
4743 | }
|
4744 |
|
4745 | function _isThisQuarter(date, options) {
|
4746 | return _isSameQuarter(_constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, date), _constructNow((options === null || options === void 0 ? void 0 : options.in) || date));
|
4747 | }
|
4748 |
|
4749 | function _isThisSecond(date) {
|
4750 | return _isSameSecond(date, _constructNow(date));
|
4751 | }
|
4752 |
|
4753 | function _isThisWeek(date, options) {
|
4754 | return _isSameWeek(_constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, date), _constructNow((options === null || options === void 0 ? void 0 : options.in) || date), options);
|
4755 | }
|
4756 |
|
4757 | function _isThisYear(date, options) {
|
4758 | return _isSameYear(_constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, date), _constructNow((options === null || options === void 0 ? void 0 : options.in) || date));
|
4759 | }
|
4760 |
|
4761 | function _isThursday(date, options) {
|
4762 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDay() === 4;
|
4763 | }
|
4764 |
|
4765 | function _isToday(date, options) {
|
4766 | return _isSameDay(_constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, date), _constructNow((options === null || options === void 0 ? void 0 : options.in) || date));
|
4767 | }
|
4768 |
|
4769 | function _isTomorrow(date, options) {
|
4770 | return _isSameDay(date, _addDays(_constructNow((options === null || options === void 0 ? void 0 : options.in) || date), 1), options);
|
4771 | }
|
4772 |
|
4773 | function _isTuesday(date, options) {
|
4774 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDay() === 2;
|
4775 | }
|
4776 |
|
4777 | function _isWednesday(date, options) {
|
4778 | return _toDate(date, options === null || options === void 0 ? void 0 : options.in).getDay() === 3;
|
4779 | }
|
4780 |
|
4781 | function _isWithinInterval(date, interval2, options) {
|
4782 | var time = +_toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
4783 | var _sort9 = [
|
4784 | +_toDate(interval2.start, options === null || options === void 0 ? void 0 : options.in),
|
4785 | +_toDate(interval2.end, options === null || options === void 0 ? void 0 : options.in)].
|
4786 | sort(function (a, b) {return a - b;}),_sort10 = _slicedToArray(_sort9, 2),startTime = _sort10[0],endTime = _sort10[1];
|
4787 | return time >= startTime && time <= endTime;
|
4788 | }
|
4789 |
|
4790 | function _subDays(date, amount, options) {
|
4791 | return _addDays(date, -amount, options);
|
4792 | }
|
4793 |
|
4794 |
|
4795 | function _isYesterday(date, options) {
|
4796 | return _isSameDay(_constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, date), _subDays(_constructNow((options === null || options === void 0 ? void 0 : options.in) || date), 1));
|
4797 | }
|
4798 |
|
4799 | function _lastDayOfDecade(date, options) {
|
4800 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
4801 | var year = _date.getFullYear();
|
4802 | var decade = 9 + Math.floor(year / 10) * 10;
|
4803 | _date.setFullYear(decade + 1, 0, 0);
|
4804 | _date.setHours(0, 0, 0, 0);
|
4805 | return _toDate(_date, options === null || options === void 0 ? void 0 : options.in);
|
4806 | }
|
4807 |
|
4808 | function _lastDayOfWeek(date, options) {var _ref40, _ref41, _ref42, _options$weekStartsOn8, _options$locale18, _defaultOptions15$loc;
|
4809 | var defaultOptions15 = getDefaultOptions();
|
4810 | var weekStartsOn = (_ref40 = (_ref41 = (_ref42 = (_options$weekStartsOn8 = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn8 !== void 0 ? _options$weekStartsOn8 : options === null || options === void 0 || (_options$locale18 = options.locale) === null || _options$locale18 === void 0 || (_options$locale18 = _options$locale18.options) === null || _options$locale18 === void 0 ? void 0 : _options$locale18.weekStartsOn) !== null && _ref42 !== void 0 ? _ref42 : defaultOptions15.weekStartsOn) !== null && _ref41 !== void 0 ? _ref41 : (_defaultOptions15$loc = defaultOptions15.locale) === null || _defaultOptions15$loc === void 0 || (_defaultOptions15$loc = _defaultOptions15$loc.options) === null || _defaultOptions15$loc === void 0 ? void 0 : _defaultOptions15$loc.weekStartsOn) !== null && _ref40 !== void 0 ? _ref40 : 0;
|
4811 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
4812 | var day = _date.getDay();
|
4813 | var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
|
4814 | _date.setHours(0, 0, 0, 0);
|
4815 | _date.setDate(_date.getDate() + diff);
|
4816 | return _date;
|
4817 | }
|
4818 |
|
4819 |
|
4820 | function _lastDayOfISOWeek(date, options) {
|
4821 | return _lastDayOfWeek(date, _objectSpread(_objectSpread({}, options), {}, { weekStartsOn: 1 }));
|
4822 | }
|
4823 |
|
4824 | function _lastDayOfISOWeekYear(date, options) {
|
4825 | var year = _getISOWeekYear(date, options);
|
4826 | var fourthOfJanuary = _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, 0);
|
4827 | fourthOfJanuary.setFullYear(year + 1, 0, 4);
|
4828 | fourthOfJanuary.setHours(0, 0, 0, 0);
|
4829 | var date_ = _startOfISOWeek(fourthOfJanuary, options);
|
4830 | date_.setDate(date_.getDate() - 1);
|
4831 | return date_;
|
4832 | }
|
4833 |
|
4834 | function _lastDayOfQuarter(date, options) {
|
4835 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
4836 | var currentMonth = date_.getMonth();
|
4837 | var month = currentMonth - currentMonth % 3 + 3;
|
4838 | date_.setMonth(month, 0);
|
4839 | date_.setHours(0, 0, 0, 0);
|
4840 | return date_;
|
4841 | }
|
4842 |
|
4843 | function _lastDayOfYear(date, options) {
|
4844 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
4845 | var year = date_.getFullYear();
|
4846 | date_.setFullYear(year + 1, 0, 0);
|
4847 | date_.setHours(0, 0, 0, 0);
|
4848 | return date_;
|
4849 | }
|
4850 |
|
4851 | function _lightFormat(date, formatStr) {
|
4852 | var date_ = _toDate(date);
|
4853 | if (!_isValid(date_)) {
|
4854 | throw new RangeError("Invalid time value");
|
4855 | }
|
4856 | var tokens = formatStr.match(formattingTokensRegExp3);
|
4857 | if (!tokens)
|
4858 | return "";
|
4859 | var result = tokens.map(function (substring) {
|
4860 | if (substring === "''") {
|
4861 | return "'";
|
4862 | }
|
4863 | var firstCharacter = substring[0];
|
4864 | if (firstCharacter === "'") {
|
4865 | return cleanEscapedString3(substring);
|
4866 | }
|
4867 | var formatter = _lightFormatters[firstCharacter];
|
4868 | if (formatter) {
|
4869 | return formatter(date_, substring);
|
4870 | }
|
4871 | if (firstCharacter.match(unescapedLatinCharacterRegExp3)) {
|
4872 | throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
|
4873 | }
|
4874 | return substring;
|
4875 | }).join("");
|
4876 | return result;
|
4877 | }
|
4878 | function cleanEscapedString3(input) {
|
4879 | var matches = input.match(escapedStringRegExp3);
|
4880 | if (!matches)
|
4881 | return input;
|
4882 | return matches[1].replace(doubleQuoteRegExp3, "'");
|
4883 | }
|
4884 | var formattingTokensRegExp3 = /(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
4885 | var escapedStringRegExp3 = /^'([^]*?)'?$/;
|
4886 | var doubleQuoteRegExp3 = /''/g;
|
4887 | var unescapedLatinCharacterRegExp3 = /[a-zA-Z]/;
|
4888 |
|
4889 | function _milliseconds(_ref43)
|
4890 |
|
4891 |
|
4892 |
|
4893 |
|
4894 |
|
4895 |
|
4896 |
|
4897 | {var years = _ref43.years,months2 = _ref43.months,weeks = _ref43.weeks,days2 = _ref43.days,hours = _ref43.hours,minutes = _ref43.minutes,seconds = _ref43.seconds;
|
4898 | var totalDays = 0;
|
4899 | if (years)
|
4900 | totalDays += years * daysInYear;
|
4901 | if (months2)
|
4902 | totalDays += months2 * (daysInYear / 12);
|
4903 | if (weeks)
|
4904 | totalDays += weeks * 7;
|
4905 | if (days2)
|
4906 | totalDays += days2;
|
4907 | var totalSeconds = totalDays * 24 * 60 * 60;
|
4908 | if (hours)
|
4909 | totalSeconds += hours * 60 * 60;
|
4910 | if (minutes)
|
4911 | totalSeconds += minutes * 60;
|
4912 | if (seconds)
|
4913 | totalSeconds += seconds;
|
4914 | return Math.trunc(totalSeconds * 1000);
|
4915 | }
|
4916 |
|
4917 | function _millisecondsToHours(milliseconds2) {
|
4918 | var hours = milliseconds2 / millisecondsInHour;
|
4919 | return Math.trunc(hours);
|
4920 | }
|
4921 |
|
4922 | function _millisecondsToMinutes(milliseconds2) {
|
4923 | var minutes = milliseconds2 / millisecondsInMinute;
|
4924 | return Math.trunc(minutes);
|
4925 | }
|
4926 |
|
4927 | function _millisecondsToSeconds(milliseconds2) {
|
4928 | var seconds = milliseconds2 / millisecondsInSecond;
|
4929 | return Math.trunc(seconds);
|
4930 | }
|
4931 |
|
4932 | function _minutesToHours(minutes) {
|
4933 | var hours = minutes / minutesInHour;
|
4934 | return Math.trunc(hours);
|
4935 | }
|
4936 |
|
4937 | function _minutesToMilliseconds(minutes) {
|
4938 | return Math.trunc(minutes * millisecondsInMinute);
|
4939 | }
|
4940 |
|
4941 | function _minutesToSeconds(minutes) {
|
4942 | return Math.trunc(minutes * secondsInMinute);
|
4943 | }
|
4944 |
|
4945 | function _monthsToQuarters(months2) {
|
4946 | var quarters = months2 / monthsInQuarter;
|
4947 | return Math.trunc(quarters);
|
4948 | }
|
4949 |
|
4950 | function _monthsToYears(months2) {
|
4951 | var years = months2 / monthsInYear;
|
4952 | return Math.trunc(years);
|
4953 | }
|
4954 |
|
4955 | function _nextDay(date, day, options) {
|
4956 | var delta = day - _getDay(date, options);
|
4957 | if (delta <= 0)
|
4958 | delta += 7;
|
4959 | return _addDays(date, delta, options);
|
4960 | }
|
4961 |
|
4962 | function _nextFriday(date, options) {
|
4963 | return _nextDay(date, 5, options);
|
4964 | }
|
4965 |
|
4966 | function _nextMonday(date, options) {
|
4967 | return _nextDay(date, 1, options);
|
4968 | }
|
4969 |
|
4970 | function _nextSaturday(date, options) {
|
4971 | return _nextDay(date, 6, options);
|
4972 | }
|
4973 |
|
4974 | function _nextSunday(date, options) {
|
4975 | return _nextDay(date, 0, options);
|
4976 | }
|
4977 |
|
4978 | function _nextThursday(date, options) {
|
4979 | return _nextDay(date, 4, options);
|
4980 | }
|
4981 |
|
4982 | function _nextTuesday(date, options) {
|
4983 | return _nextDay(date, 2, options);
|
4984 | }
|
4985 |
|
4986 | function _nextWednesday(date, options) {
|
4987 | return _nextDay(date, 3, options);
|
4988 | }
|
4989 |
|
4990 | function _parseISO(argument, options) {var _options$additionalDi;
|
4991 | var invalidDate = function invalidDate() {return _constructFrom(options === null || options === void 0 ? void 0 : options.in, NaN);};
|
4992 | var additionalDigits = (_options$additionalDi = options === null || options === void 0 ? void 0 : options.additionalDigits) !== null && _options$additionalDi !== void 0 ? _options$additionalDi : 2;
|
4993 | var dateStrings = splitDateString(argument);
|
4994 | var date;
|
4995 | if (dateStrings.date) {
|
4996 | var parseYearResult = parseYear(dateStrings.date, additionalDigits);
|
4997 | date = parseDate(parseYearResult.restDateString, parseYearResult.year);
|
4998 | }
|
4999 | if (!date || isNaN(+date))
|
5000 | return invalidDate();
|
5001 | var timestamp = +date;
|
5002 | var time = 0;
|
5003 | var offset;
|
5004 | if (dateStrings.time) {
|
5005 | time = parseTime(dateStrings.time);
|
5006 | if (isNaN(time))
|
5007 | return invalidDate();
|
5008 | }
|
5009 | if (dateStrings.timezone) {
|
5010 | offset = parseTimezone(dateStrings.timezone);
|
5011 | if (isNaN(offset))
|
5012 | return invalidDate();
|
5013 | } else {
|
5014 | var tmpDate = new Date(timestamp + time);
|
5015 | var result = _toDate(0, options === null || options === void 0 ? void 0 : options.in);
|
5016 | result.setFullYear(tmpDate.getUTCFullYear(), tmpDate.getUTCMonth(), tmpDate.getUTCDate());
|
5017 | result.setHours(tmpDate.getUTCHours(), tmpDate.getUTCMinutes(), tmpDate.getUTCSeconds(), tmpDate.getUTCMilliseconds());
|
5018 | return result;
|
5019 | }
|
5020 | return _toDate(timestamp + time + offset, options === null || options === void 0 ? void 0 : options.in);
|
5021 | }
|
5022 | function splitDateString(dateString) {
|
5023 | var dateStrings = {};
|
5024 | var array = dateString.split(patterns.dateTimeDelimiter);
|
5025 | var timeString;
|
5026 | if (array.length > 2) {
|
5027 | return dateStrings;
|
5028 | }
|
5029 | if (/:/.test(array[0])) {
|
5030 | timeString = array[0];
|
5031 | } else {
|
5032 | dateStrings.date = array[0];
|
5033 | timeString = array[1];
|
5034 | if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
|
5035 | dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
|
5036 | timeString = dateString.substr(dateStrings.date.length, dateString.length);
|
5037 | }
|
5038 | }
|
5039 | if (timeString) {
|
5040 | var token = patterns.timezone.exec(timeString);
|
5041 | if (token) {
|
5042 | dateStrings.time = timeString.replace(token[1], "");
|
5043 | dateStrings.timezone = token[1];
|
5044 | } else {
|
5045 | dateStrings.time = timeString;
|
5046 | }
|
5047 | }
|
5048 | return dateStrings;
|
5049 | }
|
5050 | function parseYear(dateString, additionalDigits) {
|
5051 | var regex = new RegExp("^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)");
|
5052 | var captures = dateString.match(regex);
|
5053 | if (!captures)
|
5054 | return { year: NaN, restDateString: "" };
|
5055 | var year = captures[1] ? parseInt(captures[1]) : null;
|
5056 | var century = captures[2] ? parseInt(captures[2]) : null;
|
5057 | return {
|
5058 | year: century === null ? year : century * 100,
|
5059 | restDateString: dateString.slice((captures[1] || captures[2]).length)
|
5060 | };
|
5061 | }
|
5062 | function parseDate(dateString, year) {
|
5063 | if (year === null)
|
5064 | return new Date(NaN);
|
5065 | var captures = dateString.match(dateRegex);
|
5066 | if (!captures)
|
5067 | return new Date(NaN);
|
5068 | var isWeekDate = !!captures[4];
|
5069 | var dayOfYear = parseDateUnit(captures[1]);
|
5070 | var month = parseDateUnit(captures[2]) - 1;
|
5071 | var day = parseDateUnit(captures[3]);
|
5072 | var week = parseDateUnit(captures[4]);
|
5073 | var dayOfWeek = parseDateUnit(captures[5]) - 1;
|
5074 | if (isWeekDate) {
|
5075 | if (!validateWeekDate(year, week, dayOfWeek)) {
|
5076 | return new Date(NaN);
|
5077 | }
|
5078 | return dayOfISOWeekYear(year, week, dayOfWeek);
|
5079 | } else {
|
5080 | var date = new Date(0);
|
5081 | if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
|
5082 | return new Date(NaN);
|
5083 | }
|
5084 | date.setUTCFullYear(year, month, Math.max(dayOfYear, day));
|
5085 | return date;
|
5086 | }
|
5087 | }
|
5088 | function parseDateUnit(value) {
|
5089 | return value ? parseInt(value) : 1;
|
5090 | }
|
5091 | function parseTime(timeString) {
|
5092 | var captures = timeString.match(timeRegex);
|
5093 | if (!captures)
|
5094 | return NaN;
|
5095 | var hours = parseTimeUnit(captures[1]);
|
5096 | var minutes = parseTimeUnit(captures[2]);
|
5097 | var seconds = parseTimeUnit(captures[3]);
|
5098 | if (!validateTime(hours, minutes, seconds)) {
|
5099 | return NaN;
|
5100 | }
|
5101 | return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1000;
|
5102 | }
|
5103 | function parseTimeUnit(value) {
|
5104 | return value && parseFloat(value.replace(",", ".")) || 0;
|
5105 | }
|
5106 | function parseTimezone(timezoneString) {
|
5107 | if (timezoneString === "Z")
|
5108 | return 0;
|
5109 | var captures = timezoneString.match(timezoneRegex);
|
5110 | if (!captures)
|
5111 | return 0;
|
5112 | var sign = captures[1] === "+" ? -1 : 1;
|
5113 | var hours = parseInt(captures[2]);
|
5114 | var minutes = captures[3] && parseInt(captures[3]) || 0;
|
5115 | if (!validateTimezone(hours, minutes)) {
|
5116 | return NaN;
|
5117 | }
|
5118 | return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute);
|
5119 | }
|
5120 | function dayOfISOWeekYear(isoWeekYear, week, day) {
|
5121 | var date = new Date(0);
|
5122 | date.setUTCFullYear(isoWeekYear, 0, 4);
|
5123 | var fourthOfJanuaryDay = date.getUTCDay() || 7;
|
5124 | var diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
|
5125 | date.setUTCDate(date.getUTCDate() + diff);
|
5126 | return date;
|
5127 | }
|
5128 | function isLeapYearIndex2(year) {
|
5129 | return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
|
5130 | }
|
5131 | function validateDate(year, month, date) {
|
5132 | return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex2(year) ? 29 : 28));
|
5133 | }
|
5134 | function validateDayOfYearDate(year, dayOfYear) {
|
5135 | return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex2(year) ? 366 : 365);
|
5136 | }
|
5137 | function validateWeekDate(_year, week, day) {
|
5138 | return week >= 1 && week <= 53 && day >= 0 && day <= 6;
|
5139 | }
|
5140 | function validateTime(hours, minutes, seconds) {
|
5141 | if (hours === 24) {
|
5142 | return minutes === 0 && seconds === 0;
|
5143 | }
|
5144 | return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
|
5145 | }
|
5146 | function validateTimezone(_hours, minutes) {
|
5147 | return minutes >= 0 && minutes <= 59;
|
5148 | }
|
5149 | var patterns = {
|
5150 | dateTimeDelimiter: /[T ]/,
|
5151 | timeZoneDelimiter: /[Z ]/i,
|
5152 | timezone: /([Z+-].*)$/
|
5153 | };
|
5154 | var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
|
5155 | var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
|
5156 | var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
5157 | var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
5158 |
|
5159 | function _parseJSON(dateStr, options) {
|
5160 | var parts = dateStr.match(/(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d{0,7}))?(?:Z|(.)(\d{2}):?(\d{2})?)?/);
|
5161 | if (!parts)
|
5162 | return _toDate(NaN, options === null || options === void 0 ? void 0 : options.in);
|
5163 | return _toDate(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)), options === null || options === void 0 ? void 0 : options.in);
|
5164 | }
|
5165 |
|
5166 | function _previousDay(date, day, options) {
|
5167 | var delta = _getDay(date, options) - day;
|
5168 | if (delta <= 0)
|
5169 | delta += 7;
|
5170 | return _subDays(date, delta, options);
|
5171 | }
|
5172 |
|
5173 | function _previousFriday(date, options) {
|
5174 | return _previousDay(date, 5, options);
|
5175 | }
|
5176 |
|
5177 | function _previousMonday(date, options) {
|
5178 | return _previousDay(date, 1, options);
|
5179 | }
|
5180 |
|
5181 | function _previousSaturday(date, options) {
|
5182 | return _previousDay(date, 6, options);
|
5183 | }
|
5184 |
|
5185 | function _previousSunday(date, options) {
|
5186 | return _previousDay(date, 0, options);
|
5187 | }
|
5188 |
|
5189 | function _previousThursday(date, options) {
|
5190 | return _previousDay(date, 4, options);
|
5191 | }
|
5192 |
|
5193 | function _previousTuesday(date, options) {
|
5194 | return _previousDay(date, 2, options);
|
5195 | }
|
5196 |
|
5197 | function _previousWednesday(date, options) {
|
5198 | return _previousDay(date, 3, options);
|
5199 | }
|
5200 |
|
5201 | function _quartersToMonths(quarters) {
|
5202 | return Math.trunc(quarters * monthsInQuarter);
|
5203 | }
|
5204 |
|
5205 | function _quartersToYears(quarters) {
|
5206 | var years = quarters / quartersInYear;
|
5207 | return Math.trunc(years);
|
5208 | }
|
5209 |
|
5210 | function _roundToNearestHours(date, options) {var _options$nearestTo, _options$roundingMeth2;
|
5211 | var nearestTo = (_options$nearestTo = options === null || options === void 0 ? void 0 : options.nearestTo) !== null && _options$nearestTo !== void 0 ? _options$nearestTo : 1;
|
5212 | if (nearestTo < 1 || nearestTo > 12)
|
5213 | return _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, NaN);
|
5214 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5215 | var fractionalMinutes = date_.getMinutes() / 60;
|
5216 | var fractionalSeconds = date_.getSeconds() / 60 / 60;
|
5217 | var fractionalMilliseconds = date_.getMilliseconds() / 1000 / 60 / 60;
|
5218 | var hours = date_.getHours() + fractionalMinutes + fractionalSeconds + fractionalMilliseconds;
|
5219 | var method = (_options$roundingMeth2 = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth2 !== void 0 ? _options$roundingMeth2 : "round";
|
5220 | var roundingMethod = getRoundingMethod(method);
|
5221 | var roundedHours = roundingMethod(hours / nearestTo) * nearestTo;
|
5222 | date_.setHours(roundedHours, 0, 0, 0);
|
5223 | return date_;
|
5224 | }
|
5225 |
|
5226 | function _roundToNearestMinutes(date, options) {var _options$nearestTo2, _options$roundingMeth3;
|
5227 | var nearestTo = (_options$nearestTo2 = options === null || options === void 0 ? void 0 : options.nearestTo) !== null && _options$nearestTo2 !== void 0 ? _options$nearestTo2 : 1;
|
5228 | if (nearestTo < 1 || nearestTo > 30)
|
5229 | return _constructFrom(date, NaN);
|
5230 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5231 | var fractionalSeconds = date_.getSeconds() / 60;
|
5232 | var fractionalMilliseconds = date_.getMilliseconds() / 1000 / 60;
|
5233 | var minutes = date_.getMinutes() + fractionalSeconds + fractionalMilliseconds;
|
5234 | var method = (_options$roundingMeth3 = options === null || options === void 0 ? void 0 : options.roundingMethod) !== null && _options$roundingMeth3 !== void 0 ? _options$roundingMeth3 : "round";
|
5235 | var roundingMethod = getRoundingMethod(method);
|
5236 | var roundedMinutes = roundingMethod(minutes / nearestTo) * nearestTo;
|
5237 | date_.setMinutes(roundedMinutes, 0, 0);
|
5238 | return date_;
|
5239 | }
|
5240 |
|
5241 | function _secondsToHours(seconds) {
|
5242 | var hours = seconds / secondsInHour;
|
5243 | return Math.trunc(hours);
|
5244 | }
|
5245 |
|
5246 | function _secondsToMilliseconds(seconds) {
|
5247 | return seconds * millisecondsInSecond;
|
5248 | }
|
5249 |
|
5250 | function _secondsToMinutes(seconds) {
|
5251 | var minutes = seconds / secondsInMinute;
|
5252 | return Math.trunc(minutes);
|
5253 | }
|
5254 |
|
5255 | function _setMonth(date, month, options) {
|
5256 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5257 | var year = _date.getFullYear();
|
5258 | var day = _date.getDate();
|
5259 | var midMonth = _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, 0);
|
5260 | midMonth.setFullYear(year, month, 15);
|
5261 | midMonth.setHours(0, 0, 0, 0);
|
5262 | var daysInMonth = _getDaysInMonth(midMonth);
|
5263 | _date.setMonth(month, Math.min(day, daysInMonth));
|
5264 | return _date;
|
5265 | }
|
5266 |
|
5267 |
|
5268 | function _set(date, values, options) {
|
5269 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5270 | if (isNaN(+_date))
|
5271 | return _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, NaN);
|
5272 | if (values.year != null)
|
5273 | _date.setFullYear(values.year);
|
5274 | if (values.month != null)
|
5275 | _date = _setMonth(_date, values.month);
|
5276 | if (values.date != null)
|
5277 | _date.setDate(values.date);
|
5278 | if (values.hours != null)
|
5279 | _date.setHours(values.hours);
|
5280 | if (values.minutes != null)
|
5281 | _date.setMinutes(values.minutes);
|
5282 | if (values.seconds != null)
|
5283 | _date.setSeconds(values.seconds);
|
5284 | if (values.milliseconds != null)
|
5285 | _date.setMilliseconds(values.milliseconds);
|
5286 | return _date;
|
5287 | }
|
5288 |
|
5289 | function _setDate(date, dayOfMonth, options) {
|
5290 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5291 | _date.setDate(dayOfMonth);
|
5292 | return _date;
|
5293 | }
|
5294 |
|
5295 | function _setDayOfYear(date, dayOfYear, options) {
|
5296 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5297 | date_.setMonth(0);
|
5298 | date_.setDate(dayOfYear);
|
5299 | return date_;
|
5300 | }
|
5301 |
|
5302 | function setDefaultOptions2(options) {
|
5303 | var result = {};
|
5304 | var defaultOptions16 = getDefaultOptions();
|
5305 | for (var property in defaultOptions16) {
|
5306 | if (Object.prototype.hasOwnProperty.call(defaultOptions16, property)) {
|
5307 | result[property] = defaultOptions16[property];
|
5308 | }
|
5309 | }
|
5310 | for (var _property in options) {
|
5311 | if (Object.prototype.hasOwnProperty.call(options, _property)) {
|
5312 | if (options[_property] === undefined) {
|
5313 | delete result[_property];
|
5314 | } else {
|
5315 | result[_property] = options[_property];
|
5316 | }
|
5317 | }
|
5318 | }
|
5319 | setDefaultOptions(result);
|
5320 | }
|
5321 |
|
5322 | function _setHours(date, hours, options) {
|
5323 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5324 | _date.setHours(hours);
|
5325 | return _date;
|
5326 | }
|
5327 |
|
5328 | function _setMilliseconds(date, milliseconds2, options) {
|
5329 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5330 | _date.setMilliseconds(milliseconds2);
|
5331 | return _date;
|
5332 | }
|
5333 |
|
5334 | function _setMinutes(date, minutes, options) {
|
5335 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5336 | date_.setMinutes(minutes);
|
5337 | return date_;
|
5338 | }
|
5339 |
|
5340 | function _setQuarter(date, quarter, options) {
|
5341 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5342 | var oldQuarter = Math.trunc(date_.getMonth() / 3) + 1;
|
5343 | var diff = quarter - oldQuarter;
|
5344 | return _setMonth(date_, date_.getMonth() + diff * 3);
|
5345 | }
|
5346 |
|
5347 | function _setSeconds(date, seconds, options) {
|
5348 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5349 | _date.setSeconds(seconds);
|
5350 | return _date;
|
5351 | }
|
5352 |
|
5353 | function _setWeekYear(date, weekYear, options) {var _ref44, _ref45, _ref46, _options$firstWeekCon5, _options$locale19, _defaultOptions17$loc;
|
5354 | var defaultOptions17 = getDefaultOptions();
|
5355 | var firstWeekContainsDate = (_ref44 = (_ref45 = (_ref46 = (_options$firstWeekCon5 = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon5 !== void 0 ? _options$firstWeekCon5 : options === null || options === void 0 || (_options$locale19 = options.locale) === null || _options$locale19 === void 0 || (_options$locale19 = _options$locale19.options) === null || _options$locale19 === void 0 ? void 0 : _options$locale19.firstWeekContainsDate) !== null && _ref46 !== void 0 ? _ref46 : defaultOptions17.firstWeekContainsDate) !== null && _ref45 !== void 0 ? _ref45 : (_defaultOptions17$loc = defaultOptions17.locale) === null || _defaultOptions17$loc === void 0 || (_defaultOptions17$loc = _defaultOptions17$loc.options) === null || _defaultOptions17$loc === void 0 ? void 0 : _defaultOptions17$loc.firstWeekContainsDate) !== null && _ref44 !== void 0 ? _ref44 : 1;
|
5356 | var diff = _differenceInCalendarDays(_toDate(date, options === null || options === void 0 ? void 0 : options.in), _startOfWeekYear(date, options), options);
|
5357 | var firstWeek = _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, 0);
|
5358 | firstWeek.setFullYear(weekYear, 0, firstWeekContainsDate);
|
5359 | firstWeek.setHours(0, 0, 0, 0);
|
5360 | var date_ = _startOfWeekYear(firstWeek, options);
|
5361 | date_.setDate(date_.getDate() + diff);
|
5362 | return date_;
|
5363 | }
|
5364 |
|
5365 | function _setYear(date, year, options) {
|
5366 | var date_ = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5367 | if (isNaN(+date_))
|
5368 | return _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, NaN);
|
5369 | date_.setFullYear(year);
|
5370 | return date_;
|
5371 | }
|
5372 |
|
5373 | function _startOfDecade(date, options) {
|
5374 | var _date = _toDate(date, options === null || options === void 0 ? void 0 : options.in);
|
5375 | var year = _date.getFullYear();
|
5376 | var decade = Math.floor(year / 10) * 10;
|
5377 | _date.setFullYear(decade, 0, 1);
|
5378 | _date.setHours(0, 0, 0, 0);
|
5379 | return _date;
|
5380 | }
|
5381 |
|
5382 | function _startOfToday(options) {
|
5383 | return _startOfDay(Date.now(), options);
|
5384 | }
|
5385 |
|
5386 | function _startOfTomorrow(options) {
|
5387 | var now = _constructNow(options === null || options === void 0 ? void 0 : options.in);
|
5388 | var year = now.getFullYear();
|
5389 | var month = now.getMonth();
|
5390 | var day = now.getDate();
|
5391 | var date = _constructFrom(options === null || options === void 0 ? void 0 : options.in, 0);
|
5392 | date.setFullYear(year, month, day + 1);
|
5393 | date.setHours(0, 0, 0, 0);
|
5394 | return date;
|
5395 | }
|
5396 |
|
5397 | function _startOfYesterday(options) {
|
5398 | var now = _constructNow(options === null || options === void 0 ? void 0 : options.in);
|
5399 | var year = now.getFullYear();
|
5400 | var month = now.getMonth();
|
5401 | var day = now.getDate();
|
5402 | var date = _constructNow(options === null || options === void 0 ? void 0 : options.in);
|
5403 | date.setFullYear(year, month, day - 1);
|
5404 | date.setHours(0, 0, 0, 0);
|
5405 | return date;
|
5406 | }
|
5407 |
|
5408 | function _subMonths(date, amount, options) {
|
5409 | return _addMonths(date, -amount, options);
|
5410 | }
|
5411 |
|
5412 |
|
5413 | function _sub(date, duration, options) {
|
5414 | var _duration$years3 =
|
5415 |
|
5416 |
|
5417 |
|
5418 |
|
5419 |
|
5420 |
|
5421 |
|
5422 | duration.years,years = _duration$years3 === void 0 ? 0 : _duration$years3,_duration$months3 = duration.months,months2 = _duration$months3 === void 0 ? 0 : _duration$months3,_duration$weeks2 = duration.weeks,weeks = _duration$weeks2 === void 0 ? 0 : _duration$weeks2,_duration$days3 = duration.days,days2 = _duration$days3 === void 0 ? 0 : _duration$days3,_duration$hours3 = duration.hours,hours = _duration$hours3 === void 0 ? 0 : _duration$hours3,_duration$minutes3 = duration.minutes,minutes = _duration$minutes3 === void 0 ? 0 : _duration$minutes3,_duration$seconds3 = duration.seconds,seconds = _duration$seconds3 === void 0 ? 0 : _duration$seconds3;
|
5423 | var withoutMonths = _subMonths(date, months2 + years * 12, options);
|
5424 | var withoutDays = _subDays(withoutMonths, days2 + weeks * 7, options);
|
5425 | var minutesToSub = minutes + hours * 60;
|
5426 | var secondsToSub = seconds + minutesToSub * 60;
|
5427 | var msToSub = secondsToSub * 1000;
|
5428 | return _constructFrom((options === null || options === void 0 ? void 0 : options.in) || date, +withoutDays - msToSub);
|
5429 | }
|
5430 |
|
5431 | function _subBusinessDays(date, amount, options) {
|
5432 | return _addBusinessDays(date, -amount, options);
|
5433 | }
|
5434 |
|
5435 | function _subHours(date, amount, options) {
|
5436 | return _addHours(date, -amount, options);
|
5437 | }
|
5438 |
|
5439 | function _subMilliseconds(date, amount, options) {
|
5440 | return _addMilliseconds(date, -amount, options);
|
5441 | }
|
5442 |
|
5443 | function _subMinutes(date, amount, options) {
|
5444 | return _addMinutes(date, -amount, options);
|
5445 | }
|
5446 |
|
5447 | function _subQuarters(date, amount, options) {
|
5448 | return _addQuarters(date, -amount, options);
|
5449 | }
|
5450 |
|
5451 | function _subSeconds(date, amount, options) {
|
5452 | return _addSeconds(date, -amount, options);
|
5453 | }
|
5454 |
|
5455 | function _subWeeks(date, amount, options) {
|
5456 | return _addWeeks(date, -amount, options);
|
5457 | }
|
5458 |
|
5459 | function _subYears(date, amount, options) {
|
5460 | return _addYears(date, -amount, options);
|
5461 | }
|
5462 |
|
5463 | function _weeksToDays(weeks) {
|
5464 | return Math.trunc(weeks * daysInWeek);
|
5465 | }
|
5466 |
|
5467 | function _yearsToDays(years) {
|
5468 | return Math.trunc(years * daysInYear);
|
5469 | }
|
5470 |
|
5471 | function _yearsToMonths(years) {
|
5472 | return Math.trunc(years * monthsInYear);
|
5473 | }
|
5474 |
|
5475 | function _yearsToQuarters(years) {
|
5476 | return Math.trunc(years * quartersInYear);
|
5477 | }
|
5478 |
|
5479 | window.dateFns = _objectSpread(_objectSpread({},
|
5480 | window.dateFns),
|
5481 | exports_lib);
|
5482 |
|
5483 |
|
5484 |
|
5485 |
|
5486 |
|
5487 | })(); |
\ | No newline at end of file |