@redis-ui/components 46.1.3 → 47.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Badge/Badge.cjs +3 -2
- package/dist/Badge/Badge.d.ts +1 -1
- package/dist/Badge/Badge.js +4 -2
- package/dist/Toast/Toaster.style.cjs +2 -2
- package/dist/Toast/Toaster.style.js +2 -2
- package/dist/Toast/core/mapping.helpers.cjs +1 -1
- package/dist/Toast/core/mapping.helpers.js +1 -1
- package/dist/index.cjs +1 -5
- package/dist/index.d.ts +0 -1
- package/dist/index.js +2 -4
- package/dist/node_modules/react-loading-skeleton/dist/index.cjs +2 -1
- package/dist/node_modules/react-loading-skeleton/dist/index.js +2 -1
- package/dist/{packages/components/node_modules → node_modules}/react-toastify/dist/react-toastify.esm.cjs +3 -3
- package/dist/{packages/components/node_modules → node_modules}/react-toastify/dist/react-toastify.esm.js +2 -2
- package/package.json +2 -4
- package/skills/redis-ui-components/SKILL.md +0 -1
- package/skills/redis-ui-components/references/Badge.md +18 -0
- package/dist/DatePicker/DatePicker.cjs +0 -32
- package/dist/DatePicker/DatePicker.d.ts +0 -6
- package/dist/DatePicker/DatePicker.js +0 -31
- package/dist/DatePicker/DatePicker.style.cjs +0 -251
- package/dist/DatePicker/DatePicker.style.d.ts +0 -3
- package/dist/DatePicker/DatePicker.style.js +0 -249
- package/dist/DatePicker/DatePicker.types.d.ts +0 -17
- package/dist/DatePicker/DatePicker.types.js +0 -1
- package/dist/DatePicker/DatePicker.utils.cjs +0 -7
- package/dist/DatePicker/DatePicker.utils.d.ts +0 -2
- package/dist/DatePicker/DatePicker.utils.js +0 -6
- package/dist/DatePicker/RangeDatePicker.cjs +0 -30
- package/dist/DatePicker/RangeDatePicker.d.ts +0 -3
- package/dist/DatePicker/RangeDatePicker.js +0 -29
- package/dist/DatePicker/components/CustomDropdown/CustomDropdown.cjs +0 -34
- package/dist/DatePicker/components/CustomDropdown/CustomDropdown.d.ts +0 -3
- package/dist/DatePicker/components/CustomDropdown/CustomDropdown.js +0 -32
- package/dist/DatePicker/components/CustomLeftIcon/CustomLeftIcon.cjs +0 -11
- package/dist/DatePicker/components/CustomLeftIcon/CustomLeftIcon.d.ts +0 -2
- package/dist/DatePicker/components/CustomLeftIcon/CustomLeftIcon.js +0 -10
- package/dist/DatePicker/components/CustomRightIcon/CustomRightIcon.cjs +0 -11
- package/dist/DatePicker/components/CustomRightIcon/CustomRightIcon.d.ts +0 -2
- package/dist/DatePicker/components/CustomRightIcon/CustomRightIcon.js +0 -10
- package/dist/DatePicker/index.d.ts +0 -3
- package/dist/DatePicker/index.js +0 -2
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.cjs +0 -6
- package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +0 -6
- package/dist/node_modules/date-fns/_lib/defaultOptions.cjs +0 -7
- package/dist/node_modules/date-fns/_lib/defaultOptions.js +0 -7
- package/dist/node_modules/date-fns/_lib/format/formatters.cjs +0 -418
- package/dist/node_modules/date-fns/_lib/format/formatters.js +0 -418
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.cjs +0 -45
- package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +0 -45
- package/dist/node_modules/date-fns/_lib/format/longFormatters.cjs +0 -45
- package/dist/node_modules/date-fns/_lib/format/longFormatters.js +0 -45
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.cjs +0 -21
- package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +0 -21
- package/dist/node_modules/date-fns/_lib/protectedTokens.cjs +0 -28
- package/dist/node_modules/date-fns/_lib/protectedTokens.js +0 -26
- package/dist/node_modules/date-fns/addDays.cjs +0 -32
- package/dist/node_modules/date-fns/addDays.js +0 -32
- package/dist/node_modules/date-fns/addMonths.cjs +0 -42
- package/dist/node_modules/date-fns/addMonths.js +0 -42
- package/dist/node_modules/date-fns/addWeeks.cjs +0 -27
- package/dist/node_modules/date-fns/addWeeks.js +0 -27
- package/dist/node_modules/date-fns/addYears.cjs +0 -27
- package/dist/node_modules/date-fns/addYears.js +0 -27
- package/dist/node_modules/date-fns/constants.cjs +0 -39
- package/dist/node_modules/date-fns/constants.js +0 -38
- package/dist/node_modules/date-fns/constructFrom.cjs +0 -37
- package/dist/node_modules/date-fns/constructFrom.js +0 -37
- package/dist/node_modules/date-fns/differenceInCalendarDays.cjs +0 -45
- package/dist/node_modules/date-fns/differenceInCalendarDays.js +0 -45
- package/dist/node_modules/date-fns/differenceInCalendarMonths.cjs +0 -34
- package/dist/node_modules/date-fns/differenceInCalendarMonths.js +0 -34
- package/dist/node_modules/date-fns/differenceInCalendarWeeks.cjs +0 -50
- package/dist/node_modules/date-fns/differenceInCalendarWeeks.js +0 -50
- package/dist/node_modules/date-fns/endOfISOWeek.cjs +0 -29
- package/dist/node_modules/date-fns/endOfISOWeek.js +0 -29
- package/dist/node_modules/date-fns/endOfMonth.cjs +0 -31
- package/dist/node_modules/date-fns/endOfMonth.js +0 -31
- package/dist/node_modules/date-fns/endOfWeek.cjs +0 -44
- package/dist/node_modules/date-fns/endOfWeek.js +0 -44
- package/dist/node_modules/date-fns/format.cjs +0 -357
- package/dist/node_modules/date-fns/format.js +0 -357
- package/dist/node_modules/date-fns/getDayOfYear.cjs +0 -29
- package/dist/node_modules/date-fns/getDayOfYear.js +0 -29
- package/dist/node_modules/date-fns/getDaysInMonth.cjs +0 -33
- package/dist/node_modules/date-fns/getDaysInMonth.js +0 -33
- package/dist/node_modules/date-fns/getISOWeek.cjs +0 -33
- package/dist/node_modules/date-fns/getISOWeek.js +0 -33
- package/dist/node_modules/date-fns/getISOWeekYear.cjs +0 -43
- package/dist/node_modules/date-fns/getISOWeekYear.js +0 -43
- package/dist/node_modules/date-fns/getUnixTime.cjs +0 -26
- package/dist/node_modules/date-fns/getUnixTime.js +0 -26
- package/dist/node_modules/date-fns/getWeek.cjs +0 -51
- package/dist/node_modules/date-fns/getWeek.js +0 -51
- package/dist/node_modules/date-fns/getWeekYear.cjs +0 -63
- package/dist/node_modules/date-fns/getWeekYear.js +0 -63
- package/dist/node_modules/date-fns/getWeeksInMonth.cjs +0 -38
- package/dist/node_modules/date-fns/getWeeksInMonth.js +0 -38
- package/dist/node_modules/date-fns/isAfter.cjs +0 -29
- package/dist/node_modules/date-fns/isAfter.js +0 -29
- package/dist/node_modules/date-fns/isBefore.cjs +0 -29
- package/dist/node_modules/date-fns/isBefore.js +0 -29
- package/dist/node_modules/date-fns/isDate.cjs +0 -38
- package/dist/node_modules/date-fns/isDate.js +0 -38
- package/dist/node_modules/date-fns/isSameDay.cjs +0 -39
- package/dist/node_modules/date-fns/isSameDay.js +0 -39
- package/dist/node_modules/date-fns/isSameMonth.cjs +0 -34
- package/dist/node_modules/date-fns/isSameMonth.js +0 -34
- package/dist/node_modules/date-fns/isSameYear.cjs +0 -29
- package/dist/node_modules/date-fns/isSameYear.js +0 -29
- package/dist/node_modules/date-fns/isValid.cjs +0 -43
- package/dist/node_modules/date-fns/isValid.js +0 -43
- package/dist/node_modules/date-fns/lastDayOfMonth.cjs +0 -31
- package/dist/node_modules/date-fns/lastDayOfMonth.js +0 -31
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.cjs +0 -9
- package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +0 -9
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.cjs +0 -51
- package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +0 -51
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.cjs +0 -28
- package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +0 -28
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.cjs +0 -19
- package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +0 -19
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.cjs +0 -76
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +0 -76
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.cjs +0 -32
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -32
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.cjs +0 -12
- package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +0 -12
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.cjs +0 -211
- package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -211
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.cjs +0 -123
- package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -124
- package/dist/node_modules/date-fns/locale/en-US.cjs +0 -28
- package/dist/node_modules/date-fns/locale/en-US.js +0 -28
- package/dist/node_modules/date-fns/max.cjs +0 -36
- package/dist/node_modules/date-fns/max.js +0 -36
- package/dist/node_modules/date-fns/min.cjs +0 -36
- package/dist/node_modules/date-fns/min.js +0 -36
- package/dist/node_modules/date-fns/setMonth.cjs +0 -37
- package/dist/node_modules/date-fns/setMonth.js +0 -37
- package/dist/node_modules/date-fns/setYear.cjs +0 -31
- package/dist/node_modules/date-fns/setYear.js +0 -31
- package/dist/node_modules/date-fns/startOfDay.cjs +0 -29
- package/dist/node_modules/date-fns/startOfDay.js +0 -29
- package/dist/node_modules/date-fns/startOfISOWeek.cjs +0 -29
- package/dist/node_modules/date-fns/startOfISOWeek.js +0 -29
- package/dist/node_modules/date-fns/startOfISOWeekYear.cjs +0 -36
- package/dist/node_modules/date-fns/startOfISOWeekYear.js +0 -36
- package/dist/node_modules/date-fns/startOfMonth.cjs +0 -30
- package/dist/node_modules/date-fns/startOfMonth.js +0 -30
- package/dist/node_modules/date-fns/startOfWeek.cjs +0 -44
- package/dist/node_modules/date-fns/startOfWeek.js +0 -44
- package/dist/node_modules/date-fns/startOfWeekYear.cjs +0 -55
- package/dist/node_modules/date-fns/startOfWeekYear.js +0 -55
- package/dist/node_modules/date-fns/startOfYear.cjs +0 -32
- package/dist/node_modules/date-fns/startOfYear.js +0 -32
- package/dist/node_modules/date-fns/subDays.cjs +0 -27
- package/dist/node_modules/date-fns/subDays.js +0 -27
- package/dist/node_modules/date-fns/toDate.cjs +0 -41
- package/dist/node_modules/date-fns/toDate.js +0 -41
- package/dist/node_modules/react-day-picker/dist/index.esm.cjs +0 -2094
- package/dist/node_modules/react-day-picker/dist/index.esm.js +0 -2092
- package/skills/redis-ui-components/references/DatePicker.md +0 -52
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/date-fns/_lib/protectedTokens.mjs
|
|
2
|
-
var dayOfYearTokenRE = /^D+$/;
|
|
3
|
-
var weekYearTokenRE = /^Y+$/;
|
|
4
|
-
var throwTokens = [
|
|
5
|
-
"D",
|
|
6
|
-
"DD",
|
|
7
|
-
"YY",
|
|
8
|
-
"YYYY"
|
|
9
|
-
];
|
|
10
|
-
function isProtectedDayOfYearToken(token) {
|
|
11
|
-
return dayOfYearTokenRE.test(token);
|
|
12
|
-
}
|
|
13
|
-
function isProtectedWeekYearToken(token) {
|
|
14
|
-
return weekYearTokenRE.test(token);
|
|
15
|
-
}
|
|
16
|
-
function warnOrThrowProtectedError(token, format, input) {
|
|
17
|
-
const _message = message(token, format, input);
|
|
18
|
-
console.warn(_message);
|
|
19
|
-
if (throwTokens.includes(token)) throw new RangeError(_message);
|
|
20
|
-
}
|
|
21
|
-
function message(token, format, input) {
|
|
22
|
-
const subject = token[0] === "Y" ? "years" : "days of the month";
|
|
23
|
-
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
export { isProtectedDayOfYearToken, isProtectedWeekYearToken, warnOrThrowProtectedError };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const require_toDate = require("./toDate.cjs");
|
|
2
|
-
const require_constructFrom = require("./constructFrom.cjs");
|
|
3
|
-
//#region ../../node_modules/date-fns/addDays.mjs
|
|
4
|
-
/**
|
|
5
|
-
* @name addDays
|
|
6
|
-
* @category Day Helpers
|
|
7
|
-
* @summary Add the specified number of days to the given date.
|
|
8
|
-
*
|
|
9
|
-
* @description
|
|
10
|
-
* Add the specified number of days to the given date.
|
|
11
|
-
*
|
|
12
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
13
|
-
*
|
|
14
|
-
* @param date - The date to be changed
|
|
15
|
-
* @param amount - The amount of days to be added.
|
|
16
|
-
*
|
|
17
|
-
* @returns The new date with the days added
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Add 10 days to 1 September 2014:
|
|
21
|
-
* const result = addDays(new Date(2014, 8, 1), 10)
|
|
22
|
-
* //=> Thu Sep 11 2014 00:00:00
|
|
23
|
-
*/
|
|
24
|
-
function addDays(date, amount) {
|
|
25
|
-
const _date = require_toDate.default(date);
|
|
26
|
-
if (isNaN(amount)) return require_constructFrom.default(date, NaN);
|
|
27
|
-
if (!amount) return _date;
|
|
28
|
-
_date.setDate(_date.getDate() + amount);
|
|
29
|
-
return _date;
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
exports.default = addDays;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import toDate from "./toDate.js";
|
|
2
|
-
import constructFrom from "./constructFrom.js";
|
|
3
|
-
//#region ../../node_modules/date-fns/addDays.mjs
|
|
4
|
-
/**
|
|
5
|
-
* @name addDays
|
|
6
|
-
* @category Day Helpers
|
|
7
|
-
* @summary Add the specified number of days to the given date.
|
|
8
|
-
*
|
|
9
|
-
* @description
|
|
10
|
-
* Add the specified number of days to the given date.
|
|
11
|
-
*
|
|
12
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
13
|
-
*
|
|
14
|
-
* @param date - The date to be changed
|
|
15
|
-
* @param amount - The amount of days to be added.
|
|
16
|
-
*
|
|
17
|
-
* @returns The new date with the days added
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Add 10 days to 1 September 2014:
|
|
21
|
-
* const result = addDays(new Date(2014, 8, 1), 10)
|
|
22
|
-
* //=> Thu Sep 11 2014 00:00:00
|
|
23
|
-
*/
|
|
24
|
-
function addDays(date, amount) {
|
|
25
|
-
const _date = toDate(date);
|
|
26
|
-
if (isNaN(amount)) return constructFrom(date, NaN);
|
|
27
|
-
if (!amount) return _date;
|
|
28
|
-
_date.setDate(_date.getDate() + amount);
|
|
29
|
-
return _date;
|
|
30
|
-
}
|
|
31
|
-
//#endregion
|
|
32
|
-
export { addDays as default };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const require_toDate = require("./toDate.cjs");
|
|
2
|
-
const require_constructFrom = require("./constructFrom.cjs");
|
|
3
|
-
//#region ../../node_modules/date-fns/addMonths.mjs
|
|
4
|
-
/**
|
|
5
|
-
* @name addMonths
|
|
6
|
-
* @category Month Helpers
|
|
7
|
-
* @summary Add the specified number of months to the given date.
|
|
8
|
-
*
|
|
9
|
-
* @description
|
|
10
|
-
* Add the specified number of months to the given date.
|
|
11
|
-
*
|
|
12
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
13
|
-
*
|
|
14
|
-
* @param date - The date to be changed
|
|
15
|
-
* @param amount - The amount of months to be added.
|
|
16
|
-
*
|
|
17
|
-
* @returns The new date with the months added
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Add 5 months to 1 September 2014:
|
|
21
|
-
* const result = addMonths(new Date(2014, 8, 1), 5)
|
|
22
|
-
* //=> Sun Feb 01 2015 00:00:00
|
|
23
|
-
*
|
|
24
|
-
* // Add one month to 30 January 2023:
|
|
25
|
-
* const result = addMonths(new Date(2023, 0, 30), 1)
|
|
26
|
-
* //=> Tue Feb 28 2023 00:00:00
|
|
27
|
-
*/
|
|
28
|
-
function addMonths(date, amount) {
|
|
29
|
-
const _date = require_toDate.default(date);
|
|
30
|
-
if (isNaN(amount)) return require_constructFrom.default(date, NaN);
|
|
31
|
-
if (!amount) return _date;
|
|
32
|
-
const dayOfMonth = _date.getDate();
|
|
33
|
-
const endOfDesiredMonth = require_constructFrom.default(date, _date.getTime());
|
|
34
|
-
endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
|
|
35
|
-
if (dayOfMonth >= endOfDesiredMonth.getDate()) return endOfDesiredMonth;
|
|
36
|
-
else {
|
|
37
|
-
_date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
|
|
38
|
-
return _date;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
exports.default = addMonths;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import toDate from "./toDate.js";
|
|
2
|
-
import constructFrom from "./constructFrom.js";
|
|
3
|
-
//#region ../../node_modules/date-fns/addMonths.mjs
|
|
4
|
-
/**
|
|
5
|
-
* @name addMonths
|
|
6
|
-
* @category Month Helpers
|
|
7
|
-
* @summary Add the specified number of months to the given date.
|
|
8
|
-
*
|
|
9
|
-
* @description
|
|
10
|
-
* Add the specified number of months to the given date.
|
|
11
|
-
*
|
|
12
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
13
|
-
*
|
|
14
|
-
* @param date - The date to be changed
|
|
15
|
-
* @param amount - The amount of months to be added.
|
|
16
|
-
*
|
|
17
|
-
* @returns The new date with the months added
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Add 5 months to 1 September 2014:
|
|
21
|
-
* const result = addMonths(new Date(2014, 8, 1), 5)
|
|
22
|
-
* //=> Sun Feb 01 2015 00:00:00
|
|
23
|
-
*
|
|
24
|
-
* // Add one month to 30 January 2023:
|
|
25
|
-
* const result = addMonths(new Date(2023, 0, 30), 1)
|
|
26
|
-
* //=> Tue Feb 28 2023 00:00:00
|
|
27
|
-
*/
|
|
28
|
-
function addMonths(date, amount) {
|
|
29
|
-
const _date = toDate(date);
|
|
30
|
-
if (isNaN(amount)) return constructFrom(date, NaN);
|
|
31
|
-
if (!amount) return _date;
|
|
32
|
-
const dayOfMonth = _date.getDate();
|
|
33
|
-
const endOfDesiredMonth = constructFrom(date, _date.getTime());
|
|
34
|
-
endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0);
|
|
35
|
-
if (dayOfMonth >= endOfDesiredMonth.getDate()) return endOfDesiredMonth;
|
|
36
|
-
else {
|
|
37
|
-
_date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
|
|
38
|
-
return _date;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
export { addMonths as default };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const require_addDays = require("./addDays.cjs");
|
|
2
|
-
//#region ../../node_modules/date-fns/addWeeks.mjs
|
|
3
|
-
/**
|
|
4
|
-
* @name addWeeks
|
|
5
|
-
* @category Week Helpers
|
|
6
|
-
* @summary Add the specified number of weeks to the given date.
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Add the specified number of week to the given date.
|
|
10
|
-
*
|
|
11
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
12
|
-
*
|
|
13
|
-
* @param date - The date to be changed
|
|
14
|
-
* @param amount - The amount of weeks to be added.
|
|
15
|
-
*
|
|
16
|
-
* @returns The new date with the weeks added
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // Add 4 weeks to 1 September 2014:
|
|
20
|
-
* const result = addWeeks(new Date(2014, 8, 1), 4)
|
|
21
|
-
* //=> Mon Sep 29 2014 00:00:00
|
|
22
|
-
*/
|
|
23
|
-
function addWeeks(date, amount) {
|
|
24
|
-
return require_addDays.default(date, amount * 7);
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
exports.default = addWeeks;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import addDays from "./addDays.js";
|
|
2
|
-
//#region ../../node_modules/date-fns/addWeeks.mjs
|
|
3
|
-
/**
|
|
4
|
-
* @name addWeeks
|
|
5
|
-
* @category Week Helpers
|
|
6
|
-
* @summary Add the specified number of weeks to the given date.
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Add the specified number of week to the given date.
|
|
10
|
-
*
|
|
11
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
12
|
-
*
|
|
13
|
-
* @param date - The date to be changed
|
|
14
|
-
* @param amount - The amount of weeks to be added.
|
|
15
|
-
*
|
|
16
|
-
* @returns The new date with the weeks added
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // Add 4 weeks to 1 September 2014:
|
|
20
|
-
* const result = addWeeks(new Date(2014, 8, 1), 4)
|
|
21
|
-
* //=> Mon Sep 29 2014 00:00:00
|
|
22
|
-
*/
|
|
23
|
-
function addWeeks(date, amount) {
|
|
24
|
-
return addDays(date, amount * 7);
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { addWeeks as default };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const require_addMonths = require("./addMonths.cjs");
|
|
2
|
-
//#region ../../node_modules/date-fns/addYears.mjs
|
|
3
|
-
/**
|
|
4
|
-
* @name addYears
|
|
5
|
-
* @category Year Helpers
|
|
6
|
-
* @summary Add the specified number of years to the given date.
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Add the specified number of years to the given date.
|
|
10
|
-
*
|
|
11
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
12
|
-
*
|
|
13
|
-
* @param date - The date to be changed
|
|
14
|
-
* @param amount - The amount of years to be added.
|
|
15
|
-
*
|
|
16
|
-
* @returns The new date with the years added
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // Add 5 years to 1 September 2014:
|
|
20
|
-
* const result = addYears(new Date(2014, 8, 1), 5)
|
|
21
|
-
* //=> Sun Sep 01 2019 00:00:00
|
|
22
|
-
*/
|
|
23
|
-
function addYears(date, amount) {
|
|
24
|
-
return require_addMonths.default(date, amount * 12);
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
exports.default = addYears;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import addMonths from "./addMonths.js";
|
|
2
|
-
//#region ../../node_modules/date-fns/addYears.mjs
|
|
3
|
-
/**
|
|
4
|
-
* @name addYears
|
|
5
|
-
* @category Year Helpers
|
|
6
|
-
* @summary Add the specified number of years to the given date.
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Add the specified number of years to the given date.
|
|
10
|
-
*
|
|
11
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
12
|
-
*
|
|
13
|
-
* @param date - The date to be changed
|
|
14
|
-
* @param amount - The amount of years to be added.
|
|
15
|
-
*
|
|
16
|
-
* @returns The new date with the years added
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // Add 5 years to 1 September 2014:
|
|
20
|
-
* const result = addYears(new Date(2014, 8, 1), 5)
|
|
21
|
-
* //=> Sun Sep 01 2019 00:00:00
|
|
22
|
-
*/
|
|
23
|
-
function addYears(date, amount) {
|
|
24
|
-
return addMonths(date, amount * 12);
|
|
25
|
-
}
|
|
26
|
-
//#endregion
|
|
27
|
-
export { addYears as default };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/date-fns/constants.mjs
|
|
2
|
-
/**
|
|
3
|
-
* @constant
|
|
4
|
-
* @name daysInYear
|
|
5
|
-
* @summary Days in 1 year.
|
|
6
|
-
*
|
|
7
|
-
* @description
|
|
8
|
-
* How many days in a year.
|
|
9
|
-
*
|
|
10
|
-
* One years equals 365.2425 days according to the formula:
|
|
11
|
-
*
|
|
12
|
-
* > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.
|
|
13
|
-
* > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
|
|
14
|
-
*/
|
|
15
|
-
var daysInYear = 365.2425;
|
|
16
|
-
-(Math.pow(10, 8) * 24 * 60 * 60 * 1e3);
|
|
17
|
-
/**
|
|
18
|
-
* @constant
|
|
19
|
-
* @name millisecondsInWeek
|
|
20
|
-
* @summary Milliseconds in 1 week.
|
|
21
|
-
*/
|
|
22
|
-
var millisecondsInWeek = 6048e5;
|
|
23
|
-
/**
|
|
24
|
-
* @constant
|
|
25
|
-
* @name millisecondsInDay
|
|
26
|
-
* @summary Milliseconds in 1 day.
|
|
27
|
-
*/
|
|
28
|
-
var millisecondsInDay = 864e5;
|
|
29
|
-
/**
|
|
30
|
-
* @constant
|
|
31
|
-
* @name secondsInDay
|
|
32
|
-
* @summary Seconds in 1 day.
|
|
33
|
-
*/
|
|
34
|
-
var secondsInDay = 3600 * 24;
|
|
35
|
-
secondsInDay * 7;
|
|
36
|
-
secondsInDay * daysInYear / 12 * 3;
|
|
37
|
-
//#endregion
|
|
38
|
-
exports.millisecondsInDay = millisecondsInDay;
|
|
39
|
-
exports.millisecondsInWeek = millisecondsInWeek;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/date-fns/constants.mjs
|
|
2
|
-
/**
|
|
3
|
-
* @constant
|
|
4
|
-
* @name daysInYear
|
|
5
|
-
* @summary Days in 1 year.
|
|
6
|
-
*
|
|
7
|
-
* @description
|
|
8
|
-
* How many days in a year.
|
|
9
|
-
*
|
|
10
|
-
* One years equals 365.2425 days according to the formula:
|
|
11
|
-
*
|
|
12
|
-
* > Leap year occures every 4 years, except for years that are divisable by 100 and not divisable by 400.
|
|
13
|
-
* > 1 mean year = (365+1/4-1/100+1/400) days = 365.2425 days
|
|
14
|
-
*/
|
|
15
|
-
var daysInYear = 365.2425;
|
|
16
|
-
-(Math.pow(10, 8) * 24 * 60 * 60 * 1e3);
|
|
17
|
-
/**
|
|
18
|
-
* @constant
|
|
19
|
-
* @name millisecondsInWeek
|
|
20
|
-
* @summary Milliseconds in 1 week.
|
|
21
|
-
*/
|
|
22
|
-
var millisecondsInWeek = 6048e5;
|
|
23
|
-
/**
|
|
24
|
-
* @constant
|
|
25
|
-
* @name millisecondsInDay
|
|
26
|
-
* @summary Milliseconds in 1 day.
|
|
27
|
-
*/
|
|
28
|
-
var millisecondsInDay = 864e5;
|
|
29
|
-
/**
|
|
30
|
-
* @constant
|
|
31
|
-
* @name secondsInDay
|
|
32
|
-
* @summary Seconds in 1 day.
|
|
33
|
-
*/
|
|
34
|
-
var secondsInDay = 3600 * 24;
|
|
35
|
-
secondsInDay * 7;
|
|
36
|
-
secondsInDay * daysInYear / 12 * 3;
|
|
37
|
-
//#endregion
|
|
38
|
-
export { millisecondsInDay, millisecondsInWeek };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/date-fns/constructFrom.mjs
|
|
2
|
-
/**
|
|
3
|
-
* @name constructFrom
|
|
4
|
-
* @category Generic Helpers
|
|
5
|
-
* @summary Constructs a date using the reference date and the value
|
|
6
|
-
*
|
|
7
|
-
* @description
|
|
8
|
-
* The function constructs a new date using the constructor from the reference
|
|
9
|
-
* date and the given value. It helps to build generic functions that accept
|
|
10
|
-
* date extensions.
|
|
11
|
-
*
|
|
12
|
-
* It defaults to `Date` if the passed reference date is a number or a string.
|
|
13
|
-
*
|
|
14
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
15
|
-
*
|
|
16
|
-
* @param date - The reference date to take constructor from
|
|
17
|
-
* @param value - The value to create the date
|
|
18
|
-
*
|
|
19
|
-
* @returns Date initialized using the given date and value
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* import { constructFrom } from 'date-fns'
|
|
23
|
-
*
|
|
24
|
-
* // A function that clones a date preserving the original type
|
|
25
|
-
* function cloneDate<DateType extends Date(date: DateType): DateType {
|
|
26
|
-
* return constructFrom(
|
|
27
|
-
* date, // Use contrustor from the given date
|
|
28
|
-
* date.getTime() // Use the date value to create a new date
|
|
29
|
-
* )
|
|
30
|
-
* }
|
|
31
|
-
*/
|
|
32
|
-
function constructFrom(date, value) {
|
|
33
|
-
if (date instanceof Date) return new date.constructor(value);
|
|
34
|
-
else return new Date(value);
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
exports.default = constructFrom;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/date-fns/constructFrom.mjs
|
|
2
|
-
/**
|
|
3
|
-
* @name constructFrom
|
|
4
|
-
* @category Generic Helpers
|
|
5
|
-
* @summary Constructs a date using the reference date and the value
|
|
6
|
-
*
|
|
7
|
-
* @description
|
|
8
|
-
* The function constructs a new date using the constructor from the reference
|
|
9
|
-
* date and the given value. It helps to build generic functions that accept
|
|
10
|
-
* date extensions.
|
|
11
|
-
*
|
|
12
|
-
* It defaults to `Date` if the passed reference date is a number or a string.
|
|
13
|
-
*
|
|
14
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
15
|
-
*
|
|
16
|
-
* @param date - The reference date to take constructor from
|
|
17
|
-
* @param value - The value to create the date
|
|
18
|
-
*
|
|
19
|
-
* @returns Date initialized using the given date and value
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* import { constructFrom } from 'date-fns'
|
|
23
|
-
*
|
|
24
|
-
* // A function that clones a date preserving the original type
|
|
25
|
-
* function cloneDate<DateType extends Date(date: DateType): DateType {
|
|
26
|
-
* return constructFrom(
|
|
27
|
-
* date, // Use contrustor from the given date
|
|
28
|
-
* date.getTime() // Use the date value to create a new date
|
|
29
|
-
* )
|
|
30
|
-
* }
|
|
31
|
-
*/
|
|
32
|
-
function constructFrom(date, value) {
|
|
33
|
-
if (date instanceof Date) return new date.constructor(value);
|
|
34
|
-
else return new Date(value);
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
export { constructFrom as default };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const require_constants = require("./constants.cjs");
|
|
2
|
-
const require_startOfDay = require("./startOfDay.cjs");
|
|
3
|
-
const require_getTimezoneOffsetInMilliseconds = require("./_lib/getTimezoneOffsetInMilliseconds.cjs");
|
|
4
|
-
//#region ../../node_modules/date-fns/differenceInCalendarDays.mjs
|
|
5
|
-
/**
|
|
6
|
-
* @name differenceInCalendarDays
|
|
7
|
-
* @category Day Helpers
|
|
8
|
-
* @summary Get the number of calendar days between the given dates.
|
|
9
|
-
*
|
|
10
|
-
* @description
|
|
11
|
-
* Get the number of calendar days between the given dates. This means that the times are removed
|
|
12
|
-
* from the dates and then the difference in days is calculated.
|
|
13
|
-
*
|
|
14
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
15
|
-
*
|
|
16
|
-
* @param dateLeft - The later date
|
|
17
|
-
* @param dateRight - The earlier date
|
|
18
|
-
*
|
|
19
|
-
* @returns The number of calendar days
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // How many calendar days are between
|
|
23
|
-
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
|
|
24
|
-
* const result = differenceInCalendarDays(
|
|
25
|
-
* new Date(2012, 6, 2, 0, 0),
|
|
26
|
-
* new Date(2011, 6, 2, 23, 0)
|
|
27
|
-
* )
|
|
28
|
-
* //=> 366
|
|
29
|
-
* // How many calendar days are between
|
|
30
|
-
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
|
|
31
|
-
* const result = differenceInCalendarDays(
|
|
32
|
-
* new Date(2011, 6, 3, 0, 1),
|
|
33
|
-
* new Date(2011, 6, 2, 23, 59)
|
|
34
|
-
* )
|
|
35
|
-
* //=> 1
|
|
36
|
-
*/
|
|
37
|
-
function differenceInCalendarDays(dateLeft, dateRight) {
|
|
38
|
-
const startOfDayLeft = require_startOfDay.default(dateLeft);
|
|
39
|
-
const startOfDayRight = require_startOfDay.default(dateRight);
|
|
40
|
-
const timestampLeft = +startOfDayLeft - require_getTimezoneOffsetInMilliseconds.getTimezoneOffsetInMilliseconds(startOfDayLeft);
|
|
41
|
-
const timestampRight = +startOfDayRight - require_getTimezoneOffsetInMilliseconds.getTimezoneOffsetInMilliseconds(startOfDayRight);
|
|
42
|
-
return Math.round((timestampLeft - timestampRight) / require_constants.millisecondsInDay);
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
exports.default = differenceInCalendarDays;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { millisecondsInDay } from "./constants.js";
|
|
2
|
-
import startOfDay from "./startOfDay.js";
|
|
3
|
-
import { getTimezoneOffsetInMilliseconds } from "./_lib/getTimezoneOffsetInMilliseconds.js";
|
|
4
|
-
//#region ../../node_modules/date-fns/differenceInCalendarDays.mjs
|
|
5
|
-
/**
|
|
6
|
-
* @name differenceInCalendarDays
|
|
7
|
-
* @category Day Helpers
|
|
8
|
-
* @summary Get the number of calendar days between the given dates.
|
|
9
|
-
*
|
|
10
|
-
* @description
|
|
11
|
-
* Get the number of calendar days between the given dates. This means that the times are removed
|
|
12
|
-
* from the dates and then the difference in days is calculated.
|
|
13
|
-
*
|
|
14
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
15
|
-
*
|
|
16
|
-
* @param dateLeft - The later date
|
|
17
|
-
* @param dateRight - The earlier date
|
|
18
|
-
*
|
|
19
|
-
* @returns The number of calendar days
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // How many calendar days are between
|
|
23
|
-
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
|
|
24
|
-
* const result = differenceInCalendarDays(
|
|
25
|
-
* new Date(2012, 6, 2, 0, 0),
|
|
26
|
-
* new Date(2011, 6, 2, 23, 0)
|
|
27
|
-
* )
|
|
28
|
-
* //=> 366
|
|
29
|
-
* // How many calendar days are between
|
|
30
|
-
* // 2 July 2011 23:59:00 and 3 July 2011 00:01:00?
|
|
31
|
-
* const result = differenceInCalendarDays(
|
|
32
|
-
* new Date(2011, 6, 3, 0, 1),
|
|
33
|
-
* new Date(2011, 6, 2, 23, 59)
|
|
34
|
-
* )
|
|
35
|
-
* //=> 1
|
|
36
|
-
*/
|
|
37
|
-
function differenceInCalendarDays(dateLeft, dateRight) {
|
|
38
|
-
const startOfDayLeft = startOfDay(dateLeft);
|
|
39
|
-
const startOfDayRight = startOfDay(dateRight);
|
|
40
|
-
const timestampLeft = +startOfDayLeft - getTimezoneOffsetInMilliseconds(startOfDayLeft);
|
|
41
|
-
const timestampRight = +startOfDayRight - getTimezoneOffsetInMilliseconds(startOfDayRight);
|
|
42
|
-
return Math.round((timestampLeft - timestampRight) / millisecondsInDay);
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
export { differenceInCalendarDays as default };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const require_toDate = require("./toDate.cjs");
|
|
2
|
-
//#region ../../node_modules/date-fns/differenceInCalendarMonths.mjs
|
|
3
|
-
/**
|
|
4
|
-
* @name differenceInCalendarMonths
|
|
5
|
-
* @category Month Helpers
|
|
6
|
-
* @summary Get the number of calendar months between the given dates.
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Get the number of calendar months between the given dates.
|
|
10
|
-
*
|
|
11
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
12
|
-
*
|
|
13
|
-
* @param dateLeft - The later date
|
|
14
|
-
* @param dateRight - The earlier date
|
|
15
|
-
*
|
|
16
|
-
* @returns The number of calendar months
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // How many calendar months are between 31 January 2014 and 1 September 2014?
|
|
20
|
-
* const result = differenceInCalendarMonths(
|
|
21
|
-
* new Date(2014, 8, 1),
|
|
22
|
-
* new Date(2014, 0, 31)
|
|
23
|
-
* )
|
|
24
|
-
* //=> 8
|
|
25
|
-
*/
|
|
26
|
-
function differenceInCalendarMonths(dateLeft, dateRight) {
|
|
27
|
-
const _dateLeft = require_toDate.default(dateLeft);
|
|
28
|
-
const _dateRight = require_toDate.default(dateRight);
|
|
29
|
-
const yearDiff = _dateLeft.getFullYear() - _dateRight.getFullYear();
|
|
30
|
-
const monthDiff = _dateLeft.getMonth() - _dateRight.getMonth();
|
|
31
|
-
return yearDiff * 12 + monthDiff;
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
exports.default = differenceInCalendarMonths;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import toDate from "./toDate.js";
|
|
2
|
-
//#region ../../node_modules/date-fns/differenceInCalendarMonths.mjs
|
|
3
|
-
/**
|
|
4
|
-
* @name differenceInCalendarMonths
|
|
5
|
-
* @category Month Helpers
|
|
6
|
-
* @summary Get the number of calendar months between the given dates.
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Get the number of calendar months between the given dates.
|
|
10
|
-
*
|
|
11
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
12
|
-
*
|
|
13
|
-
* @param dateLeft - The later date
|
|
14
|
-
* @param dateRight - The earlier date
|
|
15
|
-
*
|
|
16
|
-
* @returns The number of calendar months
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // How many calendar months are between 31 January 2014 and 1 September 2014?
|
|
20
|
-
* const result = differenceInCalendarMonths(
|
|
21
|
-
* new Date(2014, 8, 1),
|
|
22
|
-
* new Date(2014, 0, 31)
|
|
23
|
-
* )
|
|
24
|
-
* //=> 8
|
|
25
|
-
*/
|
|
26
|
-
function differenceInCalendarMonths(dateLeft, dateRight) {
|
|
27
|
-
const _dateLeft = toDate(dateLeft);
|
|
28
|
-
const _dateRight = toDate(dateRight);
|
|
29
|
-
const yearDiff = _dateLeft.getFullYear() - _dateRight.getFullYear();
|
|
30
|
-
const monthDiff = _dateLeft.getMonth() - _dateRight.getMonth();
|
|
31
|
-
return yearDiff * 12 + monthDiff;
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { differenceInCalendarMonths as default };
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
const require_constants = require("./constants.cjs");
|
|
2
|
-
const require_startOfWeek = require("./startOfWeek.cjs");
|
|
3
|
-
const require_getTimezoneOffsetInMilliseconds = require("./_lib/getTimezoneOffsetInMilliseconds.cjs");
|
|
4
|
-
//#region ../../node_modules/date-fns/differenceInCalendarWeeks.mjs
|
|
5
|
-
/**
|
|
6
|
-
* The {@link differenceInCalendarWeeks} function options.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* @name differenceInCalendarWeeks
|
|
10
|
-
* @category Week Helpers
|
|
11
|
-
* @summary Get the number of calendar weeks between the given dates.
|
|
12
|
-
*
|
|
13
|
-
* @description
|
|
14
|
-
* Get the number of calendar weeks between the given dates.
|
|
15
|
-
*
|
|
16
|
-
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
|
|
17
|
-
*
|
|
18
|
-
* @param dateLeft - The later date
|
|
19
|
-
* @param dateRight - The earlier date
|
|
20
|
-
* @param options - An object with options.
|
|
21
|
-
*
|
|
22
|
-
* @returns The number of calendar weeks
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* // How many calendar weeks are between 5 July 2014 and 20 July 2014?
|
|
26
|
-
* const result = differenceInCalendarWeeks(
|
|
27
|
-
* new Date(2014, 6, 20),
|
|
28
|
-
* new Date(2014, 6, 5)
|
|
29
|
-
* )
|
|
30
|
-
* //=> 3
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* // If the week starts on Monday,
|
|
34
|
-
* // how many calendar weeks are between 5 July 2014 and 20 July 2014?
|
|
35
|
-
* const result = differenceInCalendarWeeks(
|
|
36
|
-
* new Date(2014, 6, 20),
|
|
37
|
-
* new Date(2014, 6, 5),
|
|
38
|
-
* { weekStartsOn: 1 }
|
|
39
|
-
* )
|
|
40
|
-
* //=> 2
|
|
41
|
-
*/
|
|
42
|
-
function differenceInCalendarWeeks(dateLeft, dateRight, options) {
|
|
43
|
-
const startOfWeekLeft = require_startOfWeek.default(dateLeft, options);
|
|
44
|
-
const startOfWeekRight = require_startOfWeek.default(dateRight, options);
|
|
45
|
-
const timestampLeft = +startOfWeekLeft - require_getTimezoneOffsetInMilliseconds.getTimezoneOffsetInMilliseconds(startOfWeekLeft);
|
|
46
|
-
const timestampRight = +startOfWeekRight - require_getTimezoneOffsetInMilliseconds.getTimezoneOffsetInMilliseconds(startOfWeekRight);
|
|
47
|
-
return Math.round((timestampLeft - timestampRight) / require_constants.millisecondsInWeek);
|
|
48
|
-
}
|
|
49
|
-
//#endregion
|
|
50
|
-
exports.default = differenceInCalendarWeeks;
|