@redis-ui/components 46.1.2 → 47.0.0
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/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 +3 -5
- package/skills/redis-ui-components/SKILL.md +0 -1
- 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,418 +0,0 @@
|
|
|
1
|
-
import getISOWeekYear from "../../getISOWeekYear.js";
|
|
2
|
-
import getDayOfYear from "../../getDayOfYear.js";
|
|
3
|
-
import getISOWeek from "../../getISOWeek.js";
|
|
4
|
-
import getWeekYear from "../../getWeekYear.js";
|
|
5
|
-
import getWeek from "../../getWeek.js";
|
|
6
|
-
import { addLeadingZeros } from "../addLeadingZeros.js";
|
|
7
|
-
import { lightFormatters } from "./lightFormatters.js";
|
|
8
|
-
//#region ../../node_modules/date-fns/_lib/format/formatters.mjs
|
|
9
|
-
var dayPeriodEnum = {
|
|
10
|
-
am: "am",
|
|
11
|
-
pm: "pm",
|
|
12
|
-
midnight: "midnight",
|
|
13
|
-
noon: "noon",
|
|
14
|
-
morning: "morning",
|
|
15
|
-
afternoon: "afternoon",
|
|
16
|
-
evening: "evening",
|
|
17
|
-
night: "night"
|
|
18
|
-
};
|
|
19
|
-
var formatters = {
|
|
20
|
-
G: function(date, token, localize) {
|
|
21
|
-
const era = date.getFullYear() > 0 ? 1 : 0;
|
|
22
|
-
switch (token) {
|
|
23
|
-
case "G":
|
|
24
|
-
case "GG":
|
|
25
|
-
case "GGG": return localize.era(era, { width: "abbreviated" });
|
|
26
|
-
case "GGGGG": return localize.era(era, { width: "narrow" });
|
|
27
|
-
default: return localize.era(era, { width: "wide" });
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
y: function(date, token, localize) {
|
|
31
|
-
if (token === "yo") {
|
|
32
|
-
const signedYear = date.getFullYear();
|
|
33
|
-
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
34
|
-
return localize.ordinalNumber(year, { unit: "year" });
|
|
35
|
-
}
|
|
36
|
-
return lightFormatters.y(date, token);
|
|
37
|
-
},
|
|
38
|
-
Y: function(date, token, localize, options) {
|
|
39
|
-
const signedWeekYear = getWeekYear(date, options);
|
|
40
|
-
const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
|
|
41
|
-
if (token === "YY") return addLeadingZeros(weekYear % 100, 2);
|
|
42
|
-
if (token === "Yo") return localize.ordinalNumber(weekYear, { unit: "year" });
|
|
43
|
-
return addLeadingZeros(weekYear, token.length);
|
|
44
|
-
},
|
|
45
|
-
R: function(date, token) {
|
|
46
|
-
return addLeadingZeros(getISOWeekYear(date), token.length);
|
|
47
|
-
},
|
|
48
|
-
u: function(date, token) {
|
|
49
|
-
return addLeadingZeros(date.getFullYear(), token.length);
|
|
50
|
-
},
|
|
51
|
-
Q: function(date, token, localize) {
|
|
52
|
-
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
53
|
-
switch (token) {
|
|
54
|
-
case "Q": return String(quarter);
|
|
55
|
-
case "QQ": return addLeadingZeros(quarter, 2);
|
|
56
|
-
case "Qo": return localize.ordinalNumber(quarter, { unit: "quarter" });
|
|
57
|
-
case "QQQ": return localize.quarter(quarter, {
|
|
58
|
-
width: "abbreviated",
|
|
59
|
-
context: "formatting"
|
|
60
|
-
});
|
|
61
|
-
case "QQQQQ": return localize.quarter(quarter, {
|
|
62
|
-
width: "narrow",
|
|
63
|
-
context: "formatting"
|
|
64
|
-
});
|
|
65
|
-
default: return localize.quarter(quarter, {
|
|
66
|
-
width: "wide",
|
|
67
|
-
context: "formatting"
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
q: function(date, token, localize) {
|
|
72
|
-
const quarter = Math.ceil((date.getMonth() + 1) / 3);
|
|
73
|
-
switch (token) {
|
|
74
|
-
case "q": return String(quarter);
|
|
75
|
-
case "qq": return addLeadingZeros(quarter, 2);
|
|
76
|
-
case "qo": return localize.ordinalNumber(quarter, { unit: "quarter" });
|
|
77
|
-
case "qqq": return localize.quarter(quarter, {
|
|
78
|
-
width: "abbreviated",
|
|
79
|
-
context: "standalone"
|
|
80
|
-
});
|
|
81
|
-
case "qqqqq": return localize.quarter(quarter, {
|
|
82
|
-
width: "narrow",
|
|
83
|
-
context: "standalone"
|
|
84
|
-
});
|
|
85
|
-
default: return localize.quarter(quarter, {
|
|
86
|
-
width: "wide",
|
|
87
|
-
context: "standalone"
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
M: function(date, token, localize) {
|
|
92
|
-
const month = date.getMonth();
|
|
93
|
-
switch (token) {
|
|
94
|
-
case "M":
|
|
95
|
-
case "MM": return lightFormatters.M(date, token);
|
|
96
|
-
case "Mo": return localize.ordinalNumber(month + 1, { unit: "month" });
|
|
97
|
-
case "MMM": return localize.month(month, {
|
|
98
|
-
width: "abbreviated",
|
|
99
|
-
context: "formatting"
|
|
100
|
-
});
|
|
101
|
-
case "MMMMM": return localize.month(month, {
|
|
102
|
-
width: "narrow",
|
|
103
|
-
context: "formatting"
|
|
104
|
-
});
|
|
105
|
-
default: return localize.month(month, {
|
|
106
|
-
width: "wide",
|
|
107
|
-
context: "formatting"
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
L: function(date, token, localize) {
|
|
112
|
-
const month = date.getMonth();
|
|
113
|
-
switch (token) {
|
|
114
|
-
case "L": return String(month + 1);
|
|
115
|
-
case "LL": return addLeadingZeros(month + 1, 2);
|
|
116
|
-
case "Lo": return localize.ordinalNumber(month + 1, { unit: "month" });
|
|
117
|
-
case "LLL": return localize.month(month, {
|
|
118
|
-
width: "abbreviated",
|
|
119
|
-
context: "standalone"
|
|
120
|
-
});
|
|
121
|
-
case "LLLLL": return localize.month(month, {
|
|
122
|
-
width: "narrow",
|
|
123
|
-
context: "standalone"
|
|
124
|
-
});
|
|
125
|
-
default: return localize.month(month, {
|
|
126
|
-
width: "wide",
|
|
127
|
-
context: "standalone"
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
w: function(date, token, localize, options) {
|
|
132
|
-
const week = getWeek(date, options);
|
|
133
|
-
if (token === "wo") return localize.ordinalNumber(week, { unit: "week" });
|
|
134
|
-
return addLeadingZeros(week, token.length);
|
|
135
|
-
},
|
|
136
|
-
I: function(date, token, localize) {
|
|
137
|
-
const isoWeek = getISOWeek(date);
|
|
138
|
-
if (token === "Io") return localize.ordinalNumber(isoWeek, { unit: "week" });
|
|
139
|
-
return addLeadingZeros(isoWeek, token.length);
|
|
140
|
-
},
|
|
141
|
-
d: function(date, token, localize) {
|
|
142
|
-
if (token === "do") return localize.ordinalNumber(date.getDate(), { unit: "date" });
|
|
143
|
-
return lightFormatters.d(date, token);
|
|
144
|
-
},
|
|
145
|
-
D: function(date, token, localize) {
|
|
146
|
-
const dayOfYear = getDayOfYear(date);
|
|
147
|
-
if (token === "Do") return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
|
|
148
|
-
return addLeadingZeros(dayOfYear, token.length);
|
|
149
|
-
},
|
|
150
|
-
E: function(date, token, localize) {
|
|
151
|
-
const dayOfWeek = date.getDay();
|
|
152
|
-
switch (token) {
|
|
153
|
-
case "E":
|
|
154
|
-
case "EE":
|
|
155
|
-
case "EEE": return localize.day(dayOfWeek, {
|
|
156
|
-
width: "abbreviated",
|
|
157
|
-
context: "formatting"
|
|
158
|
-
});
|
|
159
|
-
case "EEEEE": return localize.day(dayOfWeek, {
|
|
160
|
-
width: "narrow",
|
|
161
|
-
context: "formatting"
|
|
162
|
-
});
|
|
163
|
-
case "EEEEEE": return localize.day(dayOfWeek, {
|
|
164
|
-
width: "short",
|
|
165
|
-
context: "formatting"
|
|
166
|
-
});
|
|
167
|
-
default: return localize.day(dayOfWeek, {
|
|
168
|
-
width: "wide",
|
|
169
|
-
context: "formatting"
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
e: function(date, token, localize, options) {
|
|
174
|
-
const dayOfWeek = date.getDay();
|
|
175
|
-
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
176
|
-
switch (token) {
|
|
177
|
-
case "e": return String(localDayOfWeek);
|
|
178
|
-
case "ee": return addLeadingZeros(localDayOfWeek, 2);
|
|
179
|
-
case "eo": return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
180
|
-
case "eee": return localize.day(dayOfWeek, {
|
|
181
|
-
width: "abbreviated",
|
|
182
|
-
context: "formatting"
|
|
183
|
-
});
|
|
184
|
-
case "eeeee": return localize.day(dayOfWeek, {
|
|
185
|
-
width: "narrow",
|
|
186
|
-
context: "formatting"
|
|
187
|
-
});
|
|
188
|
-
case "eeeeee": return localize.day(dayOfWeek, {
|
|
189
|
-
width: "short",
|
|
190
|
-
context: "formatting"
|
|
191
|
-
});
|
|
192
|
-
default: return localize.day(dayOfWeek, {
|
|
193
|
-
width: "wide",
|
|
194
|
-
context: "formatting"
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
c: function(date, token, localize, options) {
|
|
199
|
-
const dayOfWeek = date.getDay();
|
|
200
|
-
const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
|
|
201
|
-
switch (token) {
|
|
202
|
-
case "c": return String(localDayOfWeek);
|
|
203
|
-
case "cc": return addLeadingZeros(localDayOfWeek, token.length);
|
|
204
|
-
case "co": return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
|
|
205
|
-
case "ccc": return localize.day(dayOfWeek, {
|
|
206
|
-
width: "abbreviated",
|
|
207
|
-
context: "standalone"
|
|
208
|
-
});
|
|
209
|
-
case "ccccc": return localize.day(dayOfWeek, {
|
|
210
|
-
width: "narrow",
|
|
211
|
-
context: "standalone"
|
|
212
|
-
});
|
|
213
|
-
case "cccccc": return localize.day(dayOfWeek, {
|
|
214
|
-
width: "short",
|
|
215
|
-
context: "standalone"
|
|
216
|
-
});
|
|
217
|
-
default: return localize.day(dayOfWeek, {
|
|
218
|
-
width: "wide",
|
|
219
|
-
context: "standalone"
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
i: function(date, token, localize) {
|
|
224
|
-
const dayOfWeek = date.getDay();
|
|
225
|
-
const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
|
|
226
|
-
switch (token) {
|
|
227
|
-
case "i": return String(isoDayOfWeek);
|
|
228
|
-
case "ii": return addLeadingZeros(isoDayOfWeek, token.length);
|
|
229
|
-
case "io": return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
|
|
230
|
-
case "iii": return localize.day(dayOfWeek, {
|
|
231
|
-
width: "abbreviated",
|
|
232
|
-
context: "formatting"
|
|
233
|
-
});
|
|
234
|
-
case "iiiii": return localize.day(dayOfWeek, {
|
|
235
|
-
width: "narrow",
|
|
236
|
-
context: "formatting"
|
|
237
|
-
});
|
|
238
|
-
case "iiiiii": return localize.day(dayOfWeek, {
|
|
239
|
-
width: "short",
|
|
240
|
-
context: "formatting"
|
|
241
|
-
});
|
|
242
|
-
default: return localize.day(dayOfWeek, {
|
|
243
|
-
width: "wide",
|
|
244
|
-
context: "formatting"
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
a: function(date, token, localize) {
|
|
249
|
-
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
250
|
-
switch (token) {
|
|
251
|
-
case "a":
|
|
252
|
-
case "aa": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
253
|
-
width: "abbreviated",
|
|
254
|
-
context: "formatting"
|
|
255
|
-
});
|
|
256
|
-
case "aaa": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
257
|
-
width: "abbreviated",
|
|
258
|
-
context: "formatting"
|
|
259
|
-
}).toLowerCase();
|
|
260
|
-
case "aaaaa": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
261
|
-
width: "narrow",
|
|
262
|
-
context: "formatting"
|
|
263
|
-
});
|
|
264
|
-
default: return localize.dayPeriod(dayPeriodEnumValue, {
|
|
265
|
-
width: "wide",
|
|
266
|
-
context: "formatting"
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
b: function(date, token, localize) {
|
|
271
|
-
const hours = date.getHours();
|
|
272
|
-
let dayPeriodEnumValue;
|
|
273
|
-
if (hours === 12) dayPeriodEnumValue = dayPeriodEnum.noon;
|
|
274
|
-
else if (hours === 0) dayPeriodEnumValue = dayPeriodEnum.midnight;
|
|
275
|
-
else dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
|
|
276
|
-
switch (token) {
|
|
277
|
-
case "b":
|
|
278
|
-
case "bb": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
279
|
-
width: "abbreviated",
|
|
280
|
-
context: "formatting"
|
|
281
|
-
});
|
|
282
|
-
case "bbb": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
283
|
-
width: "abbreviated",
|
|
284
|
-
context: "formatting"
|
|
285
|
-
}).toLowerCase();
|
|
286
|
-
case "bbbbb": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
287
|
-
width: "narrow",
|
|
288
|
-
context: "formatting"
|
|
289
|
-
});
|
|
290
|
-
default: return localize.dayPeriod(dayPeriodEnumValue, {
|
|
291
|
-
width: "wide",
|
|
292
|
-
context: "formatting"
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
B: function(date, token, localize) {
|
|
297
|
-
const hours = date.getHours();
|
|
298
|
-
let dayPeriodEnumValue;
|
|
299
|
-
if (hours >= 17) dayPeriodEnumValue = dayPeriodEnum.evening;
|
|
300
|
-
else if (hours >= 12) dayPeriodEnumValue = dayPeriodEnum.afternoon;
|
|
301
|
-
else if (hours >= 4) dayPeriodEnumValue = dayPeriodEnum.morning;
|
|
302
|
-
else dayPeriodEnumValue = dayPeriodEnum.night;
|
|
303
|
-
switch (token) {
|
|
304
|
-
case "B":
|
|
305
|
-
case "BB":
|
|
306
|
-
case "BBB": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
307
|
-
width: "abbreviated",
|
|
308
|
-
context: "formatting"
|
|
309
|
-
});
|
|
310
|
-
case "BBBBB": return localize.dayPeriod(dayPeriodEnumValue, {
|
|
311
|
-
width: "narrow",
|
|
312
|
-
context: "formatting"
|
|
313
|
-
});
|
|
314
|
-
default: return localize.dayPeriod(dayPeriodEnumValue, {
|
|
315
|
-
width: "wide",
|
|
316
|
-
context: "formatting"
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
h: function(date, token, localize) {
|
|
321
|
-
if (token === "ho") {
|
|
322
|
-
let hours = date.getHours() % 12;
|
|
323
|
-
if (hours === 0) hours = 12;
|
|
324
|
-
return localize.ordinalNumber(hours, { unit: "hour" });
|
|
325
|
-
}
|
|
326
|
-
return lightFormatters.h(date, token);
|
|
327
|
-
},
|
|
328
|
-
H: function(date, token, localize) {
|
|
329
|
-
if (token === "Ho") return localize.ordinalNumber(date.getHours(), { unit: "hour" });
|
|
330
|
-
return lightFormatters.H(date, token);
|
|
331
|
-
},
|
|
332
|
-
K: function(date, token, localize) {
|
|
333
|
-
const hours = date.getHours() % 12;
|
|
334
|
-
if (token === "Ko") return localize.ordinalNumber(hours, { unit: "hour" });
|
|
335
|
-
return addLeadingZeros(hours, token.length);
|
|
336
|
-
},
|
|
337
|
-
k: function(date, token, localize) {
|
|
338
|
-
let hours = date.getHours();
|
|
339
|
-
if (hours === 0) hours = 24;
|
|
340
|
-
if (token === "ko") return localize.ordinalNumber(hours, { unit: "hour" });
|
|
341
|
-
return addLeadingZeros(hours, token.length);
|
|
342
|
-
},
|
|
343
|
-
m: function(date, token, localize) {
|
|
344
|
-
if (token === "mo") return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
|
|
345
|
-
return lightFormatters.m(date, token);
|
|
346
|
-
},
|
|
347
|
-
s: function(date, token, localize) {
|
|
348
|
-
if (token === "so") return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
|
|
349
|
-
return lightFormatters.s(date, token);
|
|
350
|
-
},
|
|
351
|
-
S: function(date, token) {
|
|
352
|
-
return lightFormatters.S(date, token);
|
|
353
|
-
},
|
|
354
|
-
X: function(date, token, _localize) {
|
|
355
|
-
const timezoneOffset = date.getTimezoneOffset();
|
|
356
|
-
if (timezoneOffset === 0) return "Z";
|
|
357
|
-
switch (token) {
|
|
358
|
-
case "X": return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
359
|
-
case "XXXX":
|
|
360
|
-
case "XX": return formatTimezone(timezoneOffset);
|
|
361
|
-
default: return formatTimezone(timezoneOffset, ":");
|
|
362
|
-
}
|
|
363
|
-
},
|
|
364
|
-
x: function(date, token, _localize) {
|
|
365
|
-
const timezoneOffset = date.getTimezoneOffset();
|
|
366
|
-
switch (token) {
|
|
367
|
-
case "x": return formatTimezoneWithOptionalMinutes(timezoneOffset);
|
|
368
|
-
case "xxxx":
|
|
369
|
-
case "xx": return formatTimezone(timezoneOffset);
|
|
370
|
-
default: return formatTimezone(timezoneOffset, ":");
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
O: function(date, token, _localize) {
|
|
374
|
-
const timezoneOffset = date.getTimezoneOffset();
|
|
375
|
-
switch (token) {
|
|
376
|
-
case "O":
|
|
377
|
-
case "OO":
|
|
378
|
-
case "OOO": return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
379
|
-
default: return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
380
|
-
}
|
|
381
|
-
},
|
|
382
|
-
z: function(date, token, _localize) {
|
|
383
|
-
const timezoneOffset = date.getTimezoneOffset();
|
|
384
|
-
switch (token) {
|
|
385
|
-
case "z":
|
|
386
|
-
case "zz":
|
|
387
|
-
case "zzz": return "GMT" + formatTimezoneShort(timezoneOffset, ":");
|
|
388
|
-
default: return "GMT" + formatTimezone(timezoneOffset, ":");
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
t: function(date, token, _localize) {
|
|
392
|
-
return addLeadingZeros(Math.trunc(date.getTime() / 1e3), token.length);
|
|
393
|
-
},
|
|
394
|
-
T: function(date, token, _localize) {
|
|
395
|
-
return addLeadingZeros(date.getTime(), token.length);
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
function formatTimezoneShort(offset, delimiter = "") {
|
|
399
|
-
const sign = offset > 0 ? "-" : "+";
|
|
400
|
-
const absOffset = Math.abs(offset);
|
|
401
|
-
const hours = Math.trunc(absOffset / 60);
|
|
402
|
-
const minutes = absOffset % 60;
|
|
403
|
-
if (minutes === 0) return sign + String(hours);
|
|
404
|
-
return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
|
|
405
|
-
}
|
|
406
|
-
function formatTimezoneWithOptionalMinutes(offset, delimiter) {
|
|
407
|
-
if (offset % 60 === 0) return (offset > 0 ? "-" : "+") + addLeadingZeros(Math.abs(offset) / 60, 2);
|
|
408
|
-
return formatTimezone(offset, delimiter);
|
|
409
|
-
}
|
|
410
|
-
function formatTimezone(offset, delimiter = "") {
|
|
411
|
-
const sign = offset > 0 ? "-" : "+";
|
|
412
|
-
const absOffset = Math.abs(offset);
|
|
413
|
-
const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
|
|
414
|
-
const minutes = addLeadingZeros(absOffset % 60, 2);
|
|
415
|
-
return sign + hours + delimiter + minutes;
|
|
416
|
-
}
|
|
417
|
-
//#endregion
|
|
418
|
-
export { formatters };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
const require_addLeadingZeros = require("../addLeadingZeros.cjs");
|
|
2
|
-
//#region ../../node_modules/date-fns/_lib/format/lightFormatters.mjs
|
|
3
|
-
var lightFormatters = {
|
|
4
|
-
y(date, token) {
|
|
5
|
-
const signedYear = date.getFullYear();
|
|
6
|
-
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
7
|
-
return require_addLeadingZeros.addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
|
8
|
-
},
|
|
9
|
-
M(date, token) {
|
|
10
|
-
const month = date.getMonth();
|
|
11
|
-
return token === "M" ? String(month + 1) : require_addLeadingZeros.addLeadingZeros(month + 1, 2);
|
|
12
|
-
},
|
|
13
|
-
d(date, token) {
|
|
14
|
-
return require_addLeadingZeros.addLeadingZeros(date.getDate(), token.length);
|
|
15
|
-
},
|
|
16
|
-
a(date, token) {
|
|
17
|
-
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
18
|
-
switch (token) {
|
|
19
|
-
case "a":
|
|
20
|
-
case "aa": return dayPeriodEnumValue.toUpperCase();
|
|
21
|
-
case "aaa": return dayPeriodEnumValue;
|
|
22
|
-
case "aaaaa": return dayPeriodEnumValue[0];
|
|
23
|
-
default: return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
h(date, token) {
|
|
27
|
-
return require_addLeadingZeros.addLeadingZeros(date.getHours() % 12 || 12, token.length);
|
|
28
|
-
},
|
|
29
|
-
H(date, token) {
|
|
30
|
-
return require_addLeadingZeros.addLeadingZeros(date.getHours(), token.length);
|
|
31
|
-
},
|
|
32
|
-
m(date, token) {
|
|
33
|
-
return require_addLeadingZeros.addLeadingZeros(date.getMinutes(), token.length);
|
|
34
|
-
},
|
|
35
|
-
s(date, token) {
|
|
36
|
-
return require_addLeadingZeros.addLeadingZeros(date.getSeconds(), token.length);
|
|
37
|
-
},
|
|
38
|
-
S(date, token) {
|
|
39
|
-
const numberOfDigits = token.length;
|
|
40
|
-
const milliseconds = date.getMilliseconds();
|
|
41
|
-
return require_addLeadingZeros.addLeadingZeros(Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3)), token.length);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
45
|
-
exports.lightFormatters = lightFormatters;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { addLeadingZeros } from "../addLeadingZeros.js";
|
|
2
|
-
//#region ../../node_modules/date-fns/_lib/format/lightFormatters.mjs
|
|
3
|
-
var lightFormatters = {
|
|
4
|
-
y(date, token) {
|
|
5
|
-
const signedYear = date.getFullYear();
|
|
6
|
-
const year = signedYear > 0 ? signedYear : 1 - signedYear;
|
|
7
|
-
return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
|
|
8
|
-
},
|
|
9
|
-
M(date, token) {
|
|
10
|
-
const month = date.getMonth();
|
|
11
|
-
return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
|
|
12
|
-
},
|
|
13
|
-
d(date, token) {
|
|
14
|
-
return addLeadingZeros(date.getDate(), token.length);
|
|
15
|
-
},
|
|
16
|
-
a(date, token) {
|
|
17
|
-
const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
|
|
18
|
-
switch (token) {
|
|
19
|
-
case "a":
|
|
20
|
-
case "aa": return dayPeriodEnumValue.toUpperCase();
|
|
21
|
-
case "aaa": return dayPeriodEnumValue;
|
|
22
|
-
case "aaaaa": return dayPeriodEnumValue[0];
|
|
23
|
-
default: return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
h(date, token) {
|
|
27
|
-
return addLeadingZeros(date.getHours() % 12 || 12, token.length);
|
|
28
|
-
},
|
|
29
|
-
H(date, token) {
|
|
30
|
-
return addLeadingZeros(date.getHours(), token.length);
|
|
31
|
-
},
|
|
32
|
-
m(date, token) {
|
|
33
|
-
return addLeadingZeros(date.getMinutes(), token.length);
|
|
34
|
-
},
|
|
35
|
-
s(date, token) {
|
|
36
|
-
return addLeadingZeros(date.getSeconds(), token.length);
|
|
37
|
-
},
|
|
38
|
-
S(date, token) {
|
|
39
|
-
const numberOfDigits = token.length;
|
|
40
|
-
const milliseconds = date.getMilliseconds();
|
|
41
|
-
return addLeadingZeros(Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3)), token.length);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
45
|
-
export { lightFormatters };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/date-fns/_lib/format/longFormatters.mjs
|
|
2
|
-
var dateLongFormatter = (pattern, formatLong) => {
|
|
3
|
-
switch (pattern) {
|
|
4
|
-
case "P": return formatLong.date({ width: "short" });
|
|
5
|
-
case "PP": return formatLong.date({ width: "medium" });
|
|
6
|
-
case "PPP": return formatLong.date({ width: "long" });
|
|
7
|
-
default: return formatLong.date({ width: "full" });
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var timeLongFormatter = (pattern, formatLong) => {
|
|
11
|
-
switch (pattern) {
|
|
12
|
-
case "p": return formatLong.time({ width: "short" });
|
|
13
|
-
case "pp": return formatLong.time({ width: "medium" });
|
|
14
|
-
case "ppp": return formatLong.time({ width: "long" });
|
|
15
|
-
default: return formatLong.time({ width: "full" });
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
var dateTimeLongFormatter = (pattern, formatLong) => {
|
|
19
|
-
const matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
20
|
-
const datePattern = matchResult[1];
|
|
21
|
-
const timePattern = matchResult[2];
|
|
22
|
-
if (!timePattern) return dateLongFormatter(pattern, formatLong);
|
|
23
|
-
let dateTimeFormat;
|
|
24
|
-
switch (datePattern) {
|
|
25
|
-
case "P":
|
|
26
|
-
dateTimeFormat = formatLong.dateTime({ width: "short" });
|
|
27
|
-
break;
|
|
28
|
-
case "PP":
|
|
29
|
-
dateTimeFormat = formatLong.dateTime({ width: "medium" });
|
|
30
|
-
break;
|
|
31
|
-
case "PPP":
|
|
32
|
-
dateTimeFormat = formatLong.dateTime({ width: "long" });
|
|
33
|
-
break;
|
|
34
|
-
default:
|
|
35
|
-
dateTimeFormat = formatLong.dateTime({ width: "full" });
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong));
|
|
39
|
-
};
|
|
40
|
-
var longFormatters = {
|
|
41
|
-
p: timeLongFormatter,
|
|
42
|
-
P: dateTimeLongFormatter
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
45
|
-
exports.longFormatters = longFormatters;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/date-fns/_lib/format/longFormatters.mjs
|
|
2
|
-
var dateLongFormatter = (pattern, formatLong) => {
|
|
3
|
-
switch (pattern) {
|
|
4
|
-
case "P": return formatLong.date({ width: "short" });
|
|
5
|
-
case "PP": return formatLong.date({ width: "medium" });
|
|
6
|
-
case "PPP": return formatLong.date({ width: "long" });
|
|
7
|
-
default: return formatLong.date({ width: "full" });
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var timeLongFormatter = (pattern, formatLong) => {
|
|
11
|
-
switch (pattern) {
|
|
12
|
-
case "p": return formatLong.time({ width: "short" });
|
|
13
|
-
case "pp": return formatLong.time({ width: "medium" });
|
|
14
|
-
case "ppp": return formatLong.time({ width: "long" });
|
|
15
|
-
default: return formatLong.time({ width: "full" });
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
var dateTimeLongFormatter = (pattern, formatLong) => {
|
|
19
|
-
const matchResult = pattern.match(/(P+)(p+)?/) || [];
|
|
20
|
-
const datePattern = matchResult[1];
|
|
21
|
-
const timePattern = matchResult[2];
|
|
22
|
-
if (!timePattern) return dateLongFormatter(pattern, formatLong);
|
|
23
|
-
let dateTimeFormat;
|
|
24
|
-
switch (datePattern) {
|
|
25
|
-
case "P":
|
|
26
|
-
dateTimeFormat = formatLong.dateTime({ width: "short" });
|
|
27
|
-
break;
|
|
28
|
-
case "PP":
|
|
29
|
-
dateTimeFormat = formatLong.dateTime({ width: "medium" });
|
|
30
|
-
break;
|
|
31
|
-
case "PPP":
|
|
32
|
-
dateTimeFormat = formatLong.dateTime({ width: "long" });
|
|
33
|
-
break;
|
|
34
|
-
default:
|
|
35
|
-
dateTimeFormat = formatLong.dateTime({ width: "full" });
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong));
|
|
39
|
-
};
|
|
40
|
-
var longFormatters = {
|
|
41
|
-
p: timeLongFormatter,
|
|
42
|
-
P: dateTimeLongFormatter
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
45
|
-
export { longFormatters };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const require_toDate = require("../toDate.cjs");
|
|
2
|
-
//#region ../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.mjs
|
|
3
|
-
/**
|
|
4
|
-
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
5
|
-
* They usually appear for dates that denote time before the timezones were introduced
|
|
6
|
-
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
7
|
-
* and GMT+01:00:00 after that date)
|
|
8
|
-
*
|
|
9
|
-
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
10
|
-
* which would lead to incorrect calculations.
|
|
11
|
-
*
|
|
12
|
-
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
13
|
-
*/
|
|
14
|
-
function getTimezoneOffsetInMilliseconds(date) {
|
|
15
|
-
const _date = require_toDate.default(date);
|
|
16
|
-
const utcDate = new Date(Date.UTC(_date.getFullYear(), _date.getMonth(), _date.getDate(), _date.getHours(), _date.getMinutes(), _date.getSeconds(), _date.getMilliseconds()));
|
|
17
|
-
utcDate.setUTCFullYear(_date.getFullYear());
|
|
18
|
-
return +date - +utcDate;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
exports.getTimezoneOffsetInMilliseconds = getTimezoneOffsetInMilliseconds;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import toDate from "../toDate.js";
|
|
2
|
-
//#region ../../node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.mjs
|
|
3
|
-
/**
|
|
4
|
-
* Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
|
|
5
|
-
* They usually appear for dates that denote time before the timezones were introduced
|
|
6
|
-
* (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
|
|
7
|
-
* and GMT+01:00:00 after that date)
|
|
8
|
-
*
|
|
9
|
-
* Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
|
|
10
|
-
* which would lead to incorrect calculations.
|
|
11
|
-
*
|
|
12
|
-
* This function returns the timezone offset in milliseconds that takes seconds in account.
|
|
13
|
-
*/
|
|
14
|
-
function getTimezoneOffsetInMilliseconds(date) {
|
|
15
|
-
const _date = toDate(date);
|
|
16
|
-
const utcDate = new Date(Date.UTC(_date.getFullYear(), _date.getMonth(), _date.getDate(), _date.getHours(), _date.getMinutes(), _date.getSeconds(), _date.getMilliseconds()));
|
|
17
|
-
utcDate.setUTCFullYear(_date.getFullYear());
|
|
18
|
-
return +date - +utcDate;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { getTimezoneOffsetInMilliseconds };
|
|
@@ -1,28 +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
|
-
exports.isProtectedDayOfYearToken = isProtectedDayOfYearToken;
|
|
27
|
-
exports.isProtectedWeekYearToken = isProtectedWeekYearToken;
|
|
28
|
-
exports.warnOrThrowProtectedError = warnOrThrowProtectedError;
|