@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,357 +0,0 @@
|
|
|
1
|
-
import toDate from "./toDate.js";
|
|
2
|
-
import { getDefaultOptions } from "./_lib/defaultOptions.js";
|
|
3
|
-
import isValid from "./isValid.js";
|
|
4
|
-
import enUS from "./locale/en-US.js";
|
|
5
|
-
import { formatters } from "./_lib/format/formatters.js";
|
|
6
|
-
import { longFormatters } from "./_lib/format/longFormatters.js";
|
|
7
|
-
import { isProtectedDayOfYearToken, isProtectedWeekYearToken, warnOrThrowProtectedError } from "./_lib/protectedTokens.js";
|
|
8
|
-
//#region ../../node_modules/date-fns/format.mjs
|
|
9
|
-
var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
|
|
10
|
-
var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
|
|
11
|
-
var escapedStringRegExp = /^'([^]*?)'?$/;
|
|
12
|
-
var doubleQuoteRegExp = /''/g;
|
|
13
|
-
var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
|
|
14
|
-
/**
|
|
15
|
-
* The {@link format} function options.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* @name format
|
|
19
|
-
* @alias formatDate
|
|
20
|
-
* @category Common Helpers
|
|
21
|
-
* @summary Format the date.
|
|
22
|
-
*
|
|
23
|
-
* @description
|
|
24
|
-
* Return the formatted date string in the given format. The result may vary by locale.
|
|
25
|
-
*
|
|
26
|
-
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
27
|
-
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
28
|
-
*
|
|
29
|
-
* The characters wrapped between two single quotes characters (') are escaped.
|
|
30
|
-
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
31
|
-
* (see the last example)
|
|
32
|
-
*
|
|
33
|
-
* Format of the string is based on Unicode Technical Standard #35:
|
|
34
|
-
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
35
|
-
* with a few additions (see note 7 below the table).
|
|
36
|
-
*
|
|
37
|
-
* Accepted patterns:
|
|
38
|
-
* | Unit | Pattern | Result examples | Notes |
|
|
39
|
-
* |---------------------------------|---------|-----------------------------------|-------|
|
|
40
|
-
* | Era | G..GGG | AD, BC | |
|
|
41
|
-
* | | GGGG | Anno Domini, Before Christ | 2 |
|
|
42
|
-
* | | GGGGG | A, B | |
|
|
43
|
-
* | Calendar year | y | 44, 1, 1900, 2017 | 5 |
|
|
44
|
-
* | | yo | 44th, 1st, 0th, 17th | 5,7 |
|
|
45
|
-
* | | yy | 44, 01, 00, 17 | 5 |
|
|
46
|
-
* | | yyy | 044, 001, 1900, 2017 | 5 |
|
|
47
|
-
* | | yyyy | 0044, 0001, 1900, 2017 | 5 |
|
|
48
|
-
* | | yyyyy | ... | 3,5 |
|
|
49
|
-
* | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
|
|
50
|
-
* | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
|
|
51
|
-
* | | YY | 44, 01, 00, 17 | 5,8 |
|
|
52
|
-
* | | YYY | 044, 001, 1900, 2017 | 5 |
|
|
53
|
-
* | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
|
|
54
|
-
* | | YYYYY | ... | 3,5 |
|
|
55
|
-
* | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
|
|
56
|
-
* | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
|
|
57
|
-
* | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
|
|
58
|
-
* | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
|
|
59
|
-
* | | RRRRR | ... | 3,5,7 |
|
|
60
|
-
* | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
|
|
61
|
-
* | | uu | -43, 01, 1900, 2017 | 5 |
|
|
62
|
-
* | | uuu | -043, 001, 1900, 2017 | 5 |
|
|
63
|
-
* | | uuuu | -0043, 0001, 1900, 2017 | 5 |
|
|
64
|
-
* | | uuuuu | ... | 3,5 |
|
|
65
|
-
* | Quarter (formatting) | Q | 1, 2, 3, 4 | |
|
|
66
|
-
* | | Qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
67
|
-
* | | QQ | 01, 02, 03, 04 | |
|
|
68
|
-
* | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
69
|
-
* | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
70
|
-
* | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
71
|
-
* | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
|
|
72
|
-
* | | qo | 1st, 2nd, 3rd, 4th | 7 |
|
|
73
|
-
* | | qq | 01, 02, 03, 04 | |
|
|
74
|
-
* | | qqq | Q1, Q2, Q3, Q4 | |
|
|
75
|
-
* | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
76
|
-
* | | qqqqq | 1, 2, 3, 4 | 4 |
|
|
77
|
-
* | Month (formatting) | M | 1, 2, ..., 12 | |
|
|
78
|
-
* | | Mo | 1st, 2nd, ..., 12th | 7 |
|
|
79
|
-
* | | MM | 01, 02, ..., 12 | |
|
|
80
|
-
* | | MMM | Jan, Feb, ..., Dec | |
|
|
81
|
-
* | | MMMM | January, February, ..., December | 2 |
|
|
82
|
-
* | | MMMMM | J, F, ..., D | |
|
|
83
|
-
* | Month (stand-alone) | L | 1, 2, ..., 12 | |
|
|
84
|
-
* | | Lo | 1st, 2nd, ..., 12th | 7 |
|
|
85
|
-
* | | LL | 01, 02, ..., 12 | |
|
|
86
|
-
* | | LLL | Jan, Feb, ..., Dec | |
|
|
87
|
-
* | | LLLL | January, February, ..., December | 2 |
|
|
88
|
-
* | | LLLLL | J, F, ..., D | |
|
|
89
|
-
* | Local week of year | w | 1, 2, ..., 53 | |
|
|
90
|
-
* | | wo | 1st, 2nd, ..., 53th | 7 |
|
|
91
|
-
* | | ww | 01, 02, ..., 53 | |
|
|
92
|
-
* | ISO week of year | I | 1, 2, ..., 53 | 7 |
|
|
93
|
-
* | | Io | 1st, 2nd, ..., 53th | 7 |
|
|
94
|
-
* | | II | 01, 02, ..., 53 | 7 |
|
|
95
|
-
* | Day of month | d | 1, 2, ..., 31 | |
|
|
96
|
-
* | | do | 1st, 2nd, ..., 31st | 7 |
|
|
97
|
-
* | | dd | 01, 02, ..., 31 | |
|
|
98
|
-
* | Day of year | D | 1, 2, ..., 365, 366 | 9 |
|
|
99
|
-
* | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
|
|
100
|
-
* | | DD | 01, 02, ..., 365, 366 | 9 |
|
|
101
|
-
* | | DDD | 001, 002, ..., 365, 366 | |
|
|
102
|
-
* | | DDDD | ... | 3 |
|
|
103
|
-
* | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
104
|
-
* | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
105
|
-
* | | EEEEE | M, T, W, T, F, S, S | |
|
|
106
|
-
* | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
107
|
-
* | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
|
|
108
|
-
* | | io | 1st, 2nd, ..., 7th | 7 |
|
|
109
|
-
* | | ii | 01, 02, ..., 07 | 7 |
|
|
110
|
-
* | | iii | Mon, Tue, Wed, ..., Sun | 7 |
|
|
111
|
-
* | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
|
|
112
|
-
* | | iiiii | M, T, W, T, F, S, S | 7 |
|
|
113
|
-
* | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
|
|
114
|
-
* | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
|
|
115
|
-
* | | eo | 2nd, 3rd, ..., 1st | 7 |
|
|
116
|
-
* | | ee | 02, 03, ..., 01 | |
|
|
117
|
-
* | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
118
|
-
* | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
119
|
-
* | | eeeee | M, T, W, T, F, S, S | |
|
|
120
|
-
* | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
121
|
-
* | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
|
|
122
|
-
* | | co | 2nd, 3rd, ..., 1st | 7 |
|
|
123
|
-
* | | cc | 02, 03, ..., 01 | |
|
|
124
|
-
* | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
125
|
-
* | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
126
|
-
* | | ccccc | M, T, W, T, F, S, S | |
|
|
127
|
-
* | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
128
|
-
* | AM, PM | a..aa | AM, PM | |
|
|
129
|
-
* | | aaa | am, pm | |
|
|
130
|
-
* | | aaaa | a.m., p.m. | 2 |
|
|
131
|
-
* | | aaaaa | a, p | |
|
|
132
|
-
* | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
|
|
133
|
-
* | | bbb | am, pm, noon, midnight | |
|
|
134
|
-
* | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
135
|
-
* | | bbbbb | a, p, n, mi | |
|
|
136
|
-
* | Flexible day period | B..BBB | at night, in the morning, ... | |
|
|
137
|
-
* | | BBBB | at night, in the morning, ... | 2 |
|
|
138
|
-
* | | BBBBB | at night, in the morning, ... | |
|
|
139
|
-
* | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
|
|
140
|
-
* | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
|
|
141
|
-
* | | hh | 01, 02, ..., 11, 12 | |
|
|
142
|
-
* | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
|
|
143
|
-
* | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
|
|
144
|
-
* | | HH | 00, 01, 02, ..., 23 | |
|
|
145
|
-
* | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
|
|
146
|
-
* | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
|
|
147
|
-
* | | KK | 01, 02, ..., 11, 00 | |
|
|
148
|
-
* | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
|
|
149
|
-
* | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
|
|
150
|
-
* | | kk | 24, 01, 02, ..., 23 | |
|
|
151
|
-
* | Minute | m | 0, 1, ..., 59 | |
|
|
152
|
-
* | | mo | 0th, 1st, ..., 59th | 7 |
|
|
153
|
-
* | | mm | 00, 01, ..., 59 | |
|
|
154
|
-
* | Second | s | 0, 1, ..., 59 | |
|
|
155
|
-
* | | so | 0th, 1st, ..., 59th | 7 |
|
|
156
|
-
* | | ss | 00, 01, ..., 59 | |
|
|
157
|
-
* | Fraction of second | S | 0, 1, ..., 9 | |
|
|
158
|
-
* | | SS | 00, 01, ..., 99 | |
|
|
159
|
-
* | | SSS | 000, 001, ..., 999 | |
|
|
160
|
-
* | | SSSS | ... | 3 |
|
|
161
|
-
* | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
|
|
162
|
-
* | | XX | -0800, +0530, Z | |
|
|
163
|
-
* | | XXX | -08:00, +05:30, Z | |
|
|
164
|
-
* | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
165
|
-
* | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
166
|
-
* | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
|
|
167
|
-
* | | xx | -0800, +0530, +0000 | |
|
|
168
|
-
* | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
169
|
-
* | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
170
|
-
* | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
171
|
-
* | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
|
|
172
|
-
* | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
|
|
173
|
-
* | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
|
|
174
|
-
* | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
|
|
175
|
-
* | Seconds timestamp | t | 512969520 | 7 |
|
|
176
|
-
* | | tt | ... | 3,7 |
|
|
177
|
-
* | Milliseconds timestamp | T | 512969520900 | 7 |
|
|
178
|
-
* | | TT | ... | 3,7 |
|
|
179
|
-
* | Long localized date | P | 04/29/1453 | 7 |
|
|
180
|
-
* | | PP | Apr 29, 1453 | 7 |
|
|
181
|
-
* | | PPP | April 29th, 1453 | 7 |
|
|
182
|
-
* | | PPPP | Friday, April 29th, 1453 | 2,7 |
|
|
183
|
-
* | Long localized time | p | 12:00 AM | 7 |
|
|
184
|
-
* | | pp | 12:00:00 AM | 7 |
|
|
185
|
-
* | | ppp | 12:00:00 AM GMT+2 | 7 |
|
|
186
|
-
* | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
|
|
187
|
-
* | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
|
|
188
|
-
* | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
|
|
189
|
-
* | | PPPppp | April 29th, 1453 at ... | 7 |
|
|
190
|
-
* | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
|
|
191
|
-
* Notes:
|
|
192
|
-
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
193
|
-
* are the same as "stand-alone" units, but are different in some languages.
|
|
194
|
-
* "Formatting" units are declined according to the rules of the language
|
|
195
|
-
* in the context of a date. "Stand-alone" units are always nominative singular:
|
|
196
|
-
*
|
|
197
|
-
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
198
|
-
*
|
|
199
|
-
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
200
|
-
*
|
|
201
|
-
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
202
|
-
* the single quote characters (see below).
|
|
203
|
-
* If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
|
|
204
|
-
* the output will be the same as default pattern for this unit, usually
|
|
205
|
-
* the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
|
|
206
|
-
* are marked with "2" in the last column of the table.
|
|
207
|
-
*
|
|
208
|
-
* `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
|
|
209
|
-
*
|
|
210
|
-
* `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
|
|
211
|
-
*
|
|
212
|
-
* `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
|
|
213
|
-
*
|
|
214
|
-
* `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
|
|
215
|
-
*
|
|
216
|
-
* `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
|
|
217
|
-
*
|
|
218
|
-
* 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
|
|
219
|
-
* The output will be padded with zeros to match the length of the pattern.
|
|
220
|
-
*
|
|
221
|
-
* `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
|
|
222
|
-
*
|
|
223
|
-
* 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
224
|
-
* These tokens represent the shortest form of the quarter.
|
|
225
|
-
*
|
|
226
|
-
* 5. The main difference between `y` and `u` patterns are B.C. years:
|
|
227
|
-
*
|
|
228
|
-
* | Year | `y` | `u` |
|
|
229
|
-
* |------|-----|-----|
|
|
230
|
-
* | AC 1 | 1 | 1 |
|
|
231
|
-
* | BC 1 | 1 | 0 |
|
|
232
|
-
* | BC 2 | 2 | -1 |
|
|
233
|
-
*
|
|
234
|
-
* Also `yy` always returns the last two digits of a year,
|
|
235
|
-
* while `uu` pads single digit years to 2 characters and returns other years unchanged:
|
|
236
|
-
*
|
|
237
|
-
* | Year | `yy` | `uu` |
|
|
238
|
-
* |------|------|------|
|
|
239
|
-
* | 1 | 01 | 01 |
|
|
240
|
-
* | 14 | 14 | 14 |
|
|
241
|
-
* | 376 | 76 | 376 |
|
|
242
|
-
* | 1453 | 53 | 1453 |
|
|
243
|
-
*
|
|
244
|
-
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
245
|
-
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
246
|
-
* and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)
|
|
247
|
-
* and [getWeekYear](https://date-fns.org/docs/getWeekYear)).
|
|
248
|
-
*
|
|
249
|
-
* 6. Specific non-location timezones are currently unavailable in `date-fns`,
|
|
250
|
-
* so right now these tokens fall back to GMT timezones.
|
|
251
|
-
*
|
|
252
|
-
* 7. These patterns are not in the Unicode Technical Standard #35:
|
|
253
|
-
* - `i`: ISO day of week
|
|
254
|
-
* - `I`: ISO week of year
|
|
255
|
-
* - `R`: ISO week-numbering year
|
|
256
|
-
* - `t`: seconds timestamp
|
|
257
|
-
* - `T`: milliseconds timestamp
|
|
258
|
-
* - `o`: ordinal number modifier
|
|
259
|
-
* - `P`: long localized date
|
|
260
|
-
* - `p`: long localized time
|
|
261
|
-
*
|
|
262
|
-
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
263
|
-
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
264
|
-
*
|
|
265
|
-
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
|
|
266
|
-
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
267
|
-
*
|
|
268
|
-
* @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).
|
|
269
|
-
*
|
|
270
|
-
* @param date - The original date
|
|
271
|
-
* @param format - The string of tokens
|
|
272
|
-
* @param options - An object with options
|
|
273
|
-
*
|
|
274
|
-
* @returns The formatted date string
|
|
275
|
-
*
|
|
276
|
-
* @throws `date` must not be Invalid Date
|
|
277
|
-
* @throws `options.locale` must contain `localize` property
|
|
278
|
-
* @throws `options.locale` must contain `formatLong` property
|
|
279
|
-
* @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
280
|
-
* @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
281
|
-
* @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
282
|
-
* @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
283
|
-
* @throws format string contains an unescaped latin alphabet character
|
|
284
|
-
*
|
|
285
|
-
* @example
|
|
286
|
-
* // Represent 11 February 2014 in middle-endian format:
|
|
287
|
-
* const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
|
|
288
|
-
* //=> '02/11/2014'
|
|
289
|
-
*
|
|
290
|
-
* @example
|
|
291
|
-
* // Represent 2 July 2014 in Esperanto:
|
|
292
|
-
* import { eoLocale } from 'date-fns/locale/eo'
|
|
293
|
-
* const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
|
|
294
|
-
* locale: eoLocale
|
|
295
|
-
* })
|
|
296
|
-
* //=> '2-a de julio 2014'
|
|
297
|
-
*
|
|
298
|
-
* @example
|
|
299
|
-
* // Escape string by single quote characters:
|
|
300
|
-
* const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
|
|
301
|
-
* //=> "3 o'clock"
|
|
302
|
-
*/
|
|
303
|
-
function format(date, formatStr, options) {
|
|
304
|
-
const defaultOptions = getDefaultOptions();
|
|
305
|
-
const locale = options?.locale ?? defaultOptions.locale ?? enUS;
|
|
306
|
-
const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
|
|
307
|
-
const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
|
|
308
|
-
const originalDate = toDate(date);
|
|
309
|
-
if (!isValid(originalDate)) throw new RangeError("Invalid time value");
|
|
310
|
-
let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
|
|
311
|
-
const firstCharacter = substring[0];
|
|
312
|
-
if (firstCharacter === "p" || firstCharacter === "P") {
|
|
313
|
-
const longFormatter = longFormatters[firstCharacter];
|
|
314
|
-
return longFormatter(substring, locale.formatLong);
|
|
315
|
-
}
|
|
316
|
-
return substring;
|
|
317
|
-
}).join("").match(formattingTokensRegExp).map((substring) => {
|
|
318
|
-
if (substring === "''") return {
|
|
319
|
-
isToken: false,
|
|
320
|
-
value: "'"
|
|
321
|
-
};
|
|
322
|
-
const firstCharacter = substring[0];
|
|
323
|
-
if (firstCharacter === "'") return {
|
|
324
|
-
isToken: false,
|
|
325
|
-
value: cleanEscapedString(substring)
|
|
326
|
-
};
|
|
327
|
-
if (formatters[firstCharacter]) return {
|
|
328
|
-
isToken: true,
|
|
329
|
-
value: substring
|
|
330
|
-
};
|
|
331
|
-
if (firstCharacter.match(unescapedLatinCharacterRegExp)) throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
|
|
332
|
-
return {
|
|
333
|
-
isToken: false,
|
|
334
|
-
value: substring
|
|
335
|
-
};
|
|
336
|
-
});
|
|
337
|
-
if (locale.localize.preprocessor) parts = locale.localize.preprocessor(originalDate, parts);
|
|
338
|
-
const formatterOptions = {
|
|
339
|
-
firstWeekContainsDate,
|
|
340
|
-
weekStartsOn,
|
|
341
|
-
locale
|
|
342
|
-
};
|
|
343
|
-
return parts.map((part) => {
|
|
344
|
-
if (!part.isToken) return part.value;
|
|
345
|
-
const token = part.value;
|
|
346
|
-
if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) warnOrThrowProtectedError(token, formatStr, String(date));
|
|
347
|
-
const formatter = formatters[token[0]];
|
|
348
|
-
return formatter(originalDate, token, locale.localize, formatterOptions);
|
|
349
|
-
}).join("");
|
|
350
|
-
}
|
|
351
|
-
function cleanEscapedString(input) {
|
|
352
|
-
const matched = input.match(escapedStringRegExp);
|
|
353
|
-
if (!matched) return input;
|
|
354
|
-
return matched[1].replace(doubleQuoteRegExp, "'");
|
|
355
|
-
}
|
|
356
|
-
//#endregion
|
|
357
|
-
export { format as default };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const require_toDate = require("./toDate.cjs");
|
|
2
|
-
const require_differenceInCalendarDays = require("./differenceInCalendarDays.cjs");
|
|
3
|
-
const require_startOfYear = require("./startOfYear.cjs");
|
|
4
|
-
//#region ../../node_modules/date-fns/getDayOfYear.mjs
|
|
5
|
-
/**
|
|
6
|
-
* @name getDayOfYear
|
|
7
|
-
* @category Day Helpers
|
|
8
|
-
* @summary Get the day of the year of the given date.
|
|
9
|
-
*
|
|
10
|
-
* @description
|
|
11
|
-
* Get the day of the year of the given date.
|
|
12
|
-
*
|
|
13
|
-
* @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).
|
|
14
|
-
*
|
|
15
|
-
* @param date - The given date
|
|
16
|
-
*
|
|
17
|
-
* @returns The day of year
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Which day of the year is 2 July 2014?
|
|
21
|
-
* const result = getDayOfYear(new Date(2014, 6, 2))
|
|
22
|
-
* //=> 183
|
|
23
|
-
*/
|
|
24
|
-
function getDayOfYear(date) {
|
|
25
|
-
const _date = require_toDate.default(date);
|
|
26
|
-
return require_differenceInCalendarDays.default(_date, require_startOfYear.default(_date)) + 1;
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
exports.default = getDayOfYear;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import toDate from "./toDate.js";
|
|
2
|
-
import differenceInCalendarDays from "./differenceInCalendarDays.js";
|
|
3
|
-
import startOfYear from "./startOfYear.js";
|
|
4
|
-
//#region ../../node_modules/date-fns/getDayOfYear.mjs
|
|
5
|
-
/**
|
|
6
|
-
* @name getDayOfYear
|
|
7
|
-
* @category Day Helpers
|
|
8
|
-
* @summary Get the day of the year of the given date.
|
|
9
|
-
*
|
|
10
|
-
* @description
|
|
11
|
-
* Get the day of the year of the given date.
|
|
12
|
-
*
|
|
13
|
-
* @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).
|
|
14
|
-
*
|
|
15
|
-
* @param date - The given date
|
|
16
|
-
*
|
|
17
|
-
* @returns The day of year
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* // Which day of the year is 2 July 2014?
|
|
21
|
-
* const result = getDayOfYear(new Date(2014, 6, 2))
|
|
22
|
-
* //=> 183
|
|
23
|
-
*/
|
|
24
|
-
function getDayOfYear(date) {
|
|
25
|
-
const _date = toDate(date);
|
|
26
|
-
return differenceInCalendarDays(_date, startOfYear(_date)) + 1;
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { getDayOfYear as default };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const require_toDate = require("./toDate.cjs");
|
|
2
|
-
const require_constructFrom = require("./constructFrom.cjs");
|
|
3
|
-
//#region ../../node_modules/date-fns/getDaysInMonth.mjs
|
|
4
|
-
/**
|
|
5
|
-
* @name getDaysInMonth
|
|
6
|
-
* @category Month Helpers
|
|
7
|
-
* @summary Get the number of days in a month of the given date.
|
|
8
|
-
*
|
|
9
|
-
* @description
|
|
10
|
-
* Get the number of days in a month of 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 given date
|
|
15
|
-
*
|
|
16
|
-
* @returns The number of days in a month
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // How many days are in February 2000?
|
|
20
|
-
* const result = getDaysInMonth(new Date(2000, 1))
|
|
21
|
-
* //=> 29
|
|
22
|
-
*/
|
|
23
|
-
function getDaysInMonth(date) {
|
|
24
|
-
const _date = require_toDate.default(date);
|
|
25
|
-
const year = _date.getFullYear();
|
|
26
|
-
const monthIndex = _date.getMonth();
|
|
27
|
-
const lastDayOfMonth = require_constructFrom.default(date, 0);
|
|
28
|
-
lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
|
|
29
|
-
lastDayOfMonth.setHours(0, 0, 0, 0);
|
|
30
|
-
return lastDayOfMonth.getDate();
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
exports.default = getDaysInMonth;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import toDate from "./toDate.js";
|
|
2
|
-
import constructFrom from "./constructFrom.js";
|
|
3
|
-
//#region ../../node_modules/date-fns/getDaysInMonth.mjs
|
|
4
|
-
/**
|
|
5
|
-
* @name getDaysInMonth
|
|
6
|
-
* @category Month Helpers
|
|
7
|
-
* @summary Get the number of days in a month of the given date.
|
|
8
|
-
*
|
|
9
|
-
* @description
|
|
10
|
-
* Get the number of days in a month of 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 given date
|
|
15
|
-
*
|
|
16
|
-
* @returns The number of days in a month
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* // How many days are in February 2000?
|
|
20
|
-
* const result = getDaysInMonth(new Date(2000, 1))
|
|
21
|
-
* //=> 29
|
|
22
|
-
*/
|
|
23
|
-
function getDaysInMonth(date) {
|
|
24
|
-
const _date = toDate(date);
|
|
25
|
-
const year = _date.getFullYear();
|
|
26
|
-
const monthIndex = _date.getMonth();
|
|
27
|
-
const lastDayOfMonth = constructFrom(date, 0);
|
|
28
|
-
lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
|
|
29
|
-
lastDayOfMonth.setHours(0, 0, 0, 0);
|
|
30
|
-
return lastDayOfMonth.getDate();
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
export { getDaysInMonth as default };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const require_toDate = require("./toDate.cjs");
|
|
2
|
-
const require_constants = require("./constants.cjs");
|
|
3
|
-
const require_startOfISOWeek = require("./startOfISOWeek.cjs");
|
|
4
|
-
const require_startOfISOWeekYear = require("./startOfISOWeekYear.cjs");
|
|
5
|
-
//#region ../../node_modules/date-fns/getISOWeek.mjs
|
|
6
|
-
/**
|
|
7
|
-
* @name getISOWeek
|
|
8
|
-
* @category ISO Week Helpers
|
|
9
|
-
* @summary Get the ISO week of the given date.
|
|
10
|
-
*
|
|
11
|
-
* @description
|
|
12
|
-
* Get the ISO week of the given date.
|
|
13
|
-
*
|
|
14
|
-
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
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 date - The given date
|
|
19
|
-
*
|
|
20
|
-
* @returns The ISO week
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* // Which week of the ISO-week numbering year is 2 January 2005?
|
|
24
|
-
* const result = getISOWeek(new Date(2005, 0, 2))
|
|
25
|
-
* //=> 53
|
|
26
|
-
*/
|
|
27
|
-
function getISOWeek(date) {
|
|
28
|
-
const _date = require_toDate.default(date);
|
|
29
|
-
const diff = +require_startOfISOWeek.default(_date) - +require_startOfISOWeekYear.default(_date);
|
|
30
|
-
return Math.round(diff / require_constants.millisecondsInWeek) + 1;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
exports.default = getISOWeek;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import toDate from "./toDate.js";
|
|
2
|
-
import { millisecondsInWeek } from "./constants.js";
|
|
3
|
-
import startOfISOWeek from "./startOfISOWeek.js";
|
|
4
|
-
import startOfISOWeekYear from "./startOfISOWeekYear.js";
|
|
5
|
-
//#region ../../node_modules/date-fns/getISOWeek.mjs
|
|
6
|
-
/**
|
|
7
|
-
* @name getISOWeek
|
|
8
|
-
* @category ISO Week Helpers
|
|
9
|
-
* @summary Get the ISO week of the given date.
|
|
10
|
-
*
|
|
11
|
-
* @description
|
|
12
|
-
* Get the ISO week of the given date.
|
|
13
|
-
*
|
|
14
|
-
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
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 date - The given date
|
|
19
|
-
*
|
|
20
|
-
* @returns The ISO week
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* // Which week of the ISO-week numbering year is 2 January 2005?
|
|
24
|
-
* const result = getISOWeek(new Date(2005, 0, 2))
|
|
25
|
-
* //=> 53
|
|
26
|
-
*/
|
|
27
|
-
function getISOWeek(date) {
|
|
28
|
-
const _date = toDate(date);
|
|
29
|
-
const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
|
|
30
|
-
return Math.round(diff / millisecondsInWeek) + 1;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
export { getISOWeek as default };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const require_toDate = require("./toDate.cjs");
|
|
2
|
-
const require_constructFrom = require("./constructFrom.cjs");
|
|
3
|
-
const require_startOfISOWeek = require("./startOfISOWeek.cjs");
|
|
4
|
-
//#region ../../node_modules/date-fns/getISOWeekYear.mjs
|
|
5
|
-
/**
|
|
6
|
-
* @name getISOWeekYear
|
|
7
|
-
* @category ISO Week-Numbering Year Helpers
|
|
8
|
-
* @summary Get the ISO week-numbering year of the given date.
|
|
9
|
-
*
|
|
10
|
-
* @description
|
|
11
|
-
* Get the ISO week-numbering year of the given date,
|
|
12
|
-
* which always starts 3 days before the year's first Thursday.
|
|
13
|
-
*
|
|
14
|
-
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
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 date - The given date
|
|
19
|
-
*
|
|
20
|
-
* @returns The ISO week-numbering year
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* // Which ISO-week numbering year is 2 January 2005?
|
|
24
|
-
* const result = getISOWeekYear(new Date(2005, 0, 2))
|
|
25
|
-
* //=> 2004
|
|
26
|
-
*/
|
|
27
|
-
function getISOWeekYear(date) {
|
|
28
|
-
const _date = require_toDate.default(date);
|
|
29
|
-
const year = _date.getFullYear();
|
|
30
|
-
const fourthOfJanuaryOfNextYear = require_constructFrom.default(date, 0);
|
|
31
|
-
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
32
|
-
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
|
33
|
-
const startOfNextYear = require_startOfISOWeek.default(fourthOfJanuaryOfNextYear);
|
|
34
|
-
const fourthOfJanuaryOfThisYear = require_constructFrom.default(date, 0);
|
|
35
|
-
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
|
|
36
|
-
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
|
|
37
|
-
const startOfThisYear = require_startOfISOWeek.default(fourthOfJanuaryOfThisYear);
|
|
38
|
-
if (_date.getTime() >= startOfNextYear.getTime()) return year + 1;
|
|
39
|
-
else if (_date.getTime() >= startOfThisYear.getTime()) return year;
|
|
40
|
-
else return year - 1;
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
exports.default = getISOWeekYear;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import toDate from "./toDate.js";
|
|
2
|
-
import constructFrom from "./constructFrom.js";
|
|
3
|
-
import startOfISOWeek from "./startOfISOWeek.js";
|
|
4
|
-
//#region ../../node_modules/date-fns/getISOWeekYear.mjs
|
|
5
|
-
/**
|
|
6
|
-
* @name getISOWeekYear
|
|
7
|
-
* @category ISO Week-Numbering Year Helpers
|
|
8
|
-
* @summary Get the ISO week-numbering year of the given date.
|
|
9
|
-
*
|
|
10
|
-
* @description
|
|
11
|
-
* Get the ISO week-numbering year of the given date,
|
|
12
|
-
* which always starts 3 days before the year's first Thursday.
|
|
13
|
-
*
|
|
14
|
-
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
|
|
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 date - The given date
|
|
19
|
-
*
|
|
20
|
-
* @returns The ISO week-numbering year
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* // Which ISO-week numbering year is 2 January 2005?
|
|
24
|
-
* const result = getISOWeekYear(new Date(2005, 0, 2))
|
|
25
|
-
* //=> 2004
|
|
26
|
-
*/
|
|
27
|
-
function getISOWeekYear(date) {
|
|
28
|
-
const _date = toDate(date);
|
|
29
|
-
const year = _date.getFullYear();
|
|
30
|
-
const fourthOfJanuaryOfNextYear = constructFrom(date, 0);
|
|
31
|
-
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
|
|
32
|
-
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
|
|
33
|
-
const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
|
|
34
|
-
const fourthOfJanuaryOfThisYear = constructFrom(date, 0);
|
|
35
|
-
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
|
|
36
|
-
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
|
|
37
|
-
const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
|
|
38
|
-
if (_date.getTime() >= startOfNextYear.getTime()) return year + 1;
|
|
39
|
-
else if (_date.getTime() >= startOfThisYear.getTime()) return year;
|
|
40
|
-
else return year - 1;
|
|
41
|
-
}
|
|
42
|
-
//#endregion
|
|
43
|
-
export { getISOWeekYear as default };
|