@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.
Files changed (163) hide show
  1. package/dist/Badge/Badge.cjs +3 -2
  2. package/dist/Badge/Badge.d.ts +1 -1
  3. package/dist/Badge/Badge.js +4 -2
  4. package/dist/Toast/Toaster.style.cjs +2 -2
  5. package/dist/Toast/Toaster.style.js +2 -2
  6. package/dist/Toast/core/mapping.helpers.cjs +1 -1
  7. package/dist/Toast/core/mapping.helpers.js +1 -1
  8. package/dist/index.cjs +1 -5
  9. package/dist/index.d.ts +0 -1
  10. package/dist/index.js +2 -4
  11. package/dist/node_modules/react-loading-skeleton/dist/index.cjs +2 -1
  12. package/dist/node_modules/react-loading-skeleton/dist/index.js +2 -1
  13. package/dist/{packages/components/node_modules → node_modules}/react-toastify/dist/react-toastify.esm.cjs +3 -3
  14. package/dist/{packages/components/node_modules → node_modules}/react-toastify/dist/react-toastify.esm.js +2 -2
  15. package/package.json +2 -4
  16. package/skills/redis-ui-components/SKILL.md +0 -1
  17. package/skills/redis-ui-components/references/Badge.md +18 -0
  18. package/dist/DatePicker/DatePicker.cjs +0 -32
  19. package/dist/DatePicker/DatePicker.d.ts +0 -6
  20. package/dist/DatePicker/DatePicker.js +0 -31
  21. package/dist/DatePicker/DatePicker.style.cjs +0 -251
  22. package/dist/DatePicker/DatePicker.style.d.ts +0 -3
  23. package/dist/DatePicker/DatePicker.style.js +0 -249
  24. package/dist/DatePicker/DatePicker.types.d.ts +0 -17
  25. package/dist/DatePicker/DatePicker.types.js +0 -1
  26. package/dist/DatePicker/DatePicker.utils.cjs +0 -7
  27. package/dist/DatePicker/DatePicker.utils.d.ts +0 -2
  28. package/dist/DatePicker/DatePicker.utils.js +0 -6
  29. package/dist/DatePicker/RangeDatePicker.cjs +0 -30
  30. package/dist/DatePicker/RangeDatePicker.d.ts +0 -3
  31. package/dist/DatePicker/RangeDatePicker.js +0 -29
  32. package/dist/DatePicker/components/CustomDropdown/CustomDropdown.cjs +0 -34
  33. package/dist/DatePicker/components/CustomDropdown/CustomDropdown.d.ts +0 -3
  34. package/dist/DatePicker/components/CustomDropdown/CustomDropdown.js +0 -32
  35. package/dist/DatePicker/components/CustomLeftIcon/CustomLeftIcon.cjs +0 -11
  36. package/dist/DatePicker/components/CustomLeftIcon/CustomLeftIcon.d.ts +0 -2
  37. package/dist/DatePicker/components/CustomLeftIcon/CustomLeftIcon.js +0 -10
  38. package/dist/DatePicker/components/CustomRightIcon/CustomRightIcon.cjs +0 -11
  39. package/dist/DatePicker/components/CustomRightIcon/CustomRightIcon.d.ts +0 -2
  40. package/dist/DatePicker/components/CustomRightIcon/CustomRightIcon.js +0 -10
  41. package/dist/DatePicker/index.d.ts +0 -3
  42. package/dist/DatePicker/index.js +0 -2
  43. package/dist/node_modules/date-fns/_lib/addLeadingZeros.cjs +0 -6
  44. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +0 -6
  45. package/dist/node_modules/date-fns/_lib/defaultOptions.cjs +0 -7
  46. package/dist/node_modules/date-fns/_lib/defaultOptions.js +0 -7
  47. package/dist/node_modules/date-fns/_lib/format/formatters.cjs +0 -418
  48. package/dist/node_modules/date-fns/_lib/format/formatters.js +0 -418
  49. package/dist/node_modules/date-fns/_lib/format/lightFormatters.cjs +0 -45
  50. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +0 -45
  51. package/dist/node_modules/date-fns/_lib/format/longFormatters.cjs +0 -45
  52. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +0 -45
  53. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.cjs +0 -21
  54. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +0 -21
  55. package/dist/node_modules/date-fns/_lib/protectedTokens.cjs +0 -28
  56. package/dist/node_modules/date-fns/_lib/protectedTokens.js +0 -26
  57. package/dist/node_modules/date-fns/addDays.cjs +0 -32
  58. package/dist/node_modules/date-fns/addDays.js +0 -32
  59. package/dist/node_modules/date-fns/addMonths.cjs +0 -42
  60. package/dist/node_modules/date-fns/addMonths.js +0 -42
  61. package/dist/node_modules/date-fns/addWeeks.cjs +0 -27
  62. package/dist/node_modules/date-fns/addWeeks.js +0 -27
  63. package/dist/node_modules/date-fns/addYears.cjs +0 -27
  64. package/dist/node_modules/date-fns/addYears.js +0 -27
  65. package/dist/node_modules/date-fns/constants.cjs +0 -39
  66. package/dist/node_modules/date-fns/constants.js +0 -38
  67. package/dist/node_modules/date-fns/constructFrom.cjs +0 -37
  68. package/dist/node_modules/date-fns/constructFrom.js +0 -37
  69. package/dist/node_modules/date-fns/differenceInCalendarDays.cjs +0 -45
  70. package/dist/node_modules/date-fns/differenceInCalendarDays.js +0 -45
  71. package/dist/node_modules/date-fns/differenceInCalendarMonths.cjs +0 -34
  72. package/dist/node_modules/date-fns/differenceInCalendarMonths.js +0 -34
  73. package/dist/node_modules/date-fns/differenceInCalendarWeeks.cjs +0 -50
  74. package/dist/node_modules/date-fns/differenceInCalendarWeeks.js +0 -50
  75. package/dist/node_modules/date-fns/endOfISOWeek.cjs +0 -29
  76. package/dist/node_modules/date-fns/endOfISOWeek.js +0 -29
  77. package/dist/node_modules/date-fns/endOfMonth.cjs +0 -31
  78. package/dist/node_modules/date-fns/endOfMonth.js +0 -31
  79. package/dist/node_modules/date-fns/endOfWeek.cjs +0 -44
  80. package/dist/node_modules/date-fns/endOfWeek.js +0 -44
  81. package/dist/node_modules/date-fns/format.cjs +0 -357
  82. package/dist/node_modules/date-fns/format.js +0 -357
  83. package/dist/node_modules/date-fns/getDayOfYear.cjs +0 -29
  84. package/dist/node_modules/date-fns/getDayOfYear.js +0 -29
  85. package/dist/node_modules/date-fns/getDaysInMonth.cjs +0 -33
  86. package/dist/node_modules/date-fns/getDaysInMonth.js +0 -33
  87. package/dist/node_modules/date-fns/getISOWeek.cjs +0 -33
  88. package/dist/node_modules/date-fns/getISOWeek.js +0 -33
  89. package/dist/node_modules/date-fns/getISOWeekYear.cjs +0 -43
  90. package/dist/node_modules/date-fns/getISOWeekYear.js +0 -43
  91. package/dist/node_modules/date-fns/getUnixTime.cjs +0 -26
  92. package/dist/node_modules/date-fns/getUnixTime.js +0 -26
  93. package/dist/node_modules/date-fns/getWeek.cjs +0 -51
  94. package/dist/node_modules/date-fns/getWeek.js +0 -51
  95. package/dist/node_modules/date-fns/getWeekYear.cjs +0 -63
  96. package/dist/node_modules/date-fns/getWeekYear.js +0 -63
  97. package/dist/node_modules/date-fns/getWeeksInMonth.cjs +0 -38
  98. package/dist/node_modules/date-fns/getWeeksInMonth.js +0 -38
  99. package/dist/node_modules/date-fns/isAfter.cjs +0 -29
  100. package/dist/node_modules/date-fns/isAfter.js +0 -29
  101. package/dist/node_modules/date-fns/isBefore.cjs +0 -29
  102. package/dist/node_modules/date-fns/isBefore.js +0 -29
  103. package/dist/node_modules/date-fns/isDate.cjs +0 -38
  104. package/dist/node_modules/date-fns/isDate.js +0 -38
  105. package/dist/node_modules/date-fns/isSameDay.cjs +0 -39
  106. package/dist/node_modules/date-fns/isSameDay.js +0 -39
  107. package/dist/node_modules/date-fns/isSameMonth.cjs +0 -34
  108. package/dist/node_modules/date-fns/isSameMonth.js +0 -34
  109. package/dist/node_modules/date-fns/isSameYear.cjs +0 -29
  110. package/dist/node_modules/date-fns/isSameYear.js +0 -29
  111. package/dist/node_modules/date-fns/isValid.cjs +0 -43
  112. package/dist/node_modules/date-fns/isValid.js +0 -43
  113. package/dist/node_modules/date-fns/lastDayOfMonth.cjs +0 -31
  114. package/dist/node_modules/date-fns/lastDayOfMonth.js +0 -31
  115. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.cjs +0 -9
  116. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +0 -9
  117. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.cjs +0 -51
  118. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +0 -51
  119. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.cjs +0 -28
  120. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +0 -28
  121. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.cjs +0 -19
  122. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +0 -19
  123. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.cjs +0 -76
  124. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +0 -76
  125. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.cjs +0 -32
  126. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -32
  127. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.cjs +0 -12
  128. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +0 -12
  129. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.cjs +0 -211
  130. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -211
  131. package/dist/node_modules/date-fns/locale/en-US/_lib/match.cjs +0 -123
  132. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -124
  133. package/dist/node_modules/date-fns/locale/en-US.cjs +0 -28
  134. package/dist/node_modules/date-fns/locale/en-US.js +0 -28
  135. package/dist/node_modules/date-fns/max.cjs +0 -36
  136. package/dist/node_modules/date-fns/max.js +0 -36
  137. package/dist/node_modules/date-fns/min.cjs +0 -36
  138. package/dist/node_modules/date-fns/min.js +0 -36
  139. package/dist/node_modules/date-fns/setMonth.cjs +0 -37
  140. package/dist/node_modules/date-fns/setMonth.js +0 -37
  141. package/dist/node_modules/date-fns/setYear.cjs +0 -31
  142. package/dist/node_modules/date-fns/setYear.js +0 -31
  143. package/dist/node_modules/date-fns/startOfDay.cjs +0 -29
  144. package/dist/node_modules/date-fns/startOfDay.js +0 -29
  145. package/dist/node_modules/date-fns/startOfISOWeek.cjs +0 -29
  146. package/dist/node_modules/date-fns/startOfISOWeek.js +0 -29
  147. package/dist/node_modules/date-fns/startOfISOWeekYear.cjs +0 -36
  148. package/dist/node_modules/date-fns/startOfISOWeekYear.js +0 -36
  149. package/dist/node_modules/date-fns/startOfMonth.cjs +0 -30
  150. package/dist/node_modules/date-fns/startOfMonth.js +0 -30
  151. package/dist/node_modules/date-fns/startOfWeek.cjs +0 -44
  152. package/dist/node_modules/date-fns/startOfWeek.js +0 -44
  153. package/dist/node_modules/date-fns/startOfWeekYear.cjs +0 -55
  154. package/dist/node_modules/date-fns/startOfWeekYear.js +0 -55
  155. package/dist/node_modules/date-fns/startOfYear.cjs +0 -32
  156. package/dist/node_modules/date-fns/startOfYear.js +0 -32
  157. package/dist/node_modules/date-fns/subDays.cjs +0 -27
  158. package/dist/node_modules/date-fns/subDays.js +0 -27
  159. package/dist/node_modules/date-fns/toDate.cjs +0 -41
  160. package/dist/node_modules/date-fns/toDate.js +0 -41
  161. package/dist/node_modules/react-day-picker/dist/index.esm.cjs +0 -2094
  162. package/dist/node_modules/react-day-picker/dist/index.esm.js +0 -2092
  163. package/skills/redis-ui-components/references/DatePicker.md +0 -52
@@ -1,50 +0,0 @@
1
- import { millisecondsInWeek } from "./constants.js";
2
- import startOfWeek from "./startOfWeek.js";
3
- import { getTimezoneOffsetInMilliseconds } from "./_lib/getTimezoneOffsetInMilliseconds.js";
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 = startOfWeek(dateLeft, options);
44
- const startOfWeekRight = startOfWeek(dateRight, options);
45
- const timestampLeft = +startOfWeekLeft - getTimezoneOffsetInMilliseconds(startOfWeekLeft);
46
- const timestampRight = +startOfWeekRight - getTimezoneOffsetInMilliseconds(startOfWeekRight);
47
- return Math.round((timestampLeft - timestampRight) / millisecondsInWeek);
48
- }
49
- //#endregion
50
- export { differenceInCalendarWeeks as default };
@@ -1,29 +0,0 @@
1
- const require_endOfWeek = require("./endOfWeek.cjs");
2
- //#region ../../node_modules/date-fns/endOfISOWeek.mjs
3
- /**
4
- * @name endOfISOWeek
5
- * @category ISO Week Helpers
6
- * @summary Return the end of an ISO week for the given date.
7
- *
8
- * @description
9
- * Return the end of an ISO week for the given date.
10
- * The result will be in the local timezone.
11
- *
12
- * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
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 original date
17
- *
18
- * @returns The end of an ISO week
19
- *
20
- * @example
21
- * // The end of an ISO week for 2 September 2014 11:55:00:
22
- * const result = endOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
23
- * //=> Sun Sep 07 2014 23:59:59.999
24
- */
25
- function endOfISOWeek(date) {
26
- return require_endOfWeek.default(date, { weekStartsOn: 1 });
27
- }
28
- //#endregion
29
- exports.default = endOfISOWeek;
@@ -1,29 +0,0 @@
1
- import endOfWeek from "./endOfWeek.js";
2
- //#region ../../node_modules/date-fns/endOfISOWeek.mjs
3
- /**
4
- * @name endOfISOWeek
5
- * @category ISO Week Helpers
6
- * @summary Return the end of an ISO week for the given date.
7
- *
8
- * @description
9
- * Return the end of an ISO week for the given date.
10
- * The result will be in the local timezone.
11
- *
12
- * ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
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 original date
17
- *
18
- * @returns The end of an ISO week
19
- *
20
- * @example
21
- * // The end of an ISO week for 2 September 2014 11:55:00:
22
- * const result = endOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
23
- * //=> Sun Sep 07 2014 23:59:59.999
24
- */
25
- function endOfISOWeek(date) {
26
- return endOfWeek(date, { weekStartsOn: 1 });
27
- }
28
- //#endregion
29
- export { endOfISOWeek as default };
@@ -1,31 +0,0 @@
1
- const require_toDate = require("./toDate.cjs");
2
- //#region ../../node_modules/date-fns/endOfMonth.mjs
3
- /**
4
- * @name endOfMonth
5
- * @category Month Helpers
6
- * @summary Return the end of a month for the given date.
7
- *
8
- * @description
9
- * Return the end of a month for the given date.
10
- * The result will be in the local timezone.
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 original date
15
- *
16
- * @returns The end of a month
17
- *
18
- * @example
19
- * // The end of a month for 2 September 2014 11:55:00:
20
- * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
21
- * //=> Tue Sep 30 2014 23:59:59.999
22
- */
23
- function endOfMonth(date) {
24
- const _date = require_toDate.default(date);
25
- const month = _date.getMonth();
26
- _date.setFullYear(_date.getFullYear(), month + 1, 0);
27
- _date.setHours(23, 59, 59, 999);
28
- return _date;
29
- }
30
- //#endregion
31
- exports.default = endOfMonth;
@@ -1,31 +0,0 @@
1
- import toDate from "./toDate.js";
2
- //#region ../../node_modules/date-fns/endOfMonth.mjs
3
- /**
4
- * @name endOfMonth
5
- * @category Month Helpers
6
- * @summary Return the end of a month for the given date.
7
- *
8
- * @description
9
- * Return the end of a month for the given date.
10
- * The result will be in the local timezone.
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 original date
15
- *
16
- * @returns The end of a month
17
- *
18
- * @example
19
- * // The end of a month for 2 September 2014 11:55:00:
20
- * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
21
- * //=> Tue Sep 30 2014 23:59:59.999
22
- */
23
- function endOfMonth(date) {
24
- const _date = toDate(date);
25
- const month = _date.getMonth();
26
- _date.setFullYear(_date.getFullYear(), month + 1, 0);
27
- _date.setHours(23, 59, 59, 999);
28
- return _date;
29
- }
30
- //#endregion
31
- export { endOfMonth as default };
@@ -1,44 +0,0 @@
1
- const require_toDate = require("./toDate.cjs");
2
- const require_defaultOptions = require("./_lib/defaultOptions.cjs");
3
- //#region ../../node_modules/date-fns/endOfWeek.mjs
4
- /**
5
- * The {@link endOfWeek} function options.
6
- */
7
- /**
8
- * @name endOfWeek
9
- * @category Week Helpers
10
- * @summary Return the end of a week for the given date.
11
- *
12
- * @description
13
- * Return the end of a week for the given date.
14
- * The result will be in the local timezone.
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 original date
19
- * @param options - An object with options
20
- *
21
- * @returns The end of a week
22
- *
23
- * @example
24
- * // The end of a week for 2 September 2014 11:55:00:
25
- * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
26
- * //=> Sat Sep 06 2014 23:59:59.999
27
- *
28
- * @example
29
- * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
30
- * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
31
- * //=> Sun Sep 07 2014 23:59:59.999
32
- */
33
- function endOfWeek(date, options) {
34
- const defaultOptions = require_defaultOptions.getDefaultOptions();
35
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
36
- const _date = require_toDate.default(date);
37
- const day = _date.getDay();
38
- const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
39
- _date.setDate(_date.getDate() + diff);
40
- _date.setHours(23, 59, 59, 999);
41
- return _date;
42
- }
43
- //#endregion
44
- exports.default = endOfWeek;
@@ -1,44 +0,0 @@
1
- import toDate from "./toDate.js";
2
- import { getDefaultOptions } from "./_lib/defaultOptions.js";
3
- //#region ../../node_modules/date-fns/endOfWeek.mjs
4
- /**
5
- * The {@link endOfWeek} function options.
6
- */
7
- /**
8
- * @name endOfWeek
9
- * @category Week Helpers
10
- * @summary Return the end of a week for the given date.
11
- *
12
- * @description
13
- * Return the end of a week for the given date.
14
- * The result will be in the local timezone.
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 original date
19
- * @param options - An object with options
20
- *
21
- * @returns The end of a week
22
- *
23
- * @example
24
- * // The end of a week for 2 September 2014 11:55:00:
25
- * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
26
- * //=> Sat Sep 06 2014 23:59:59.999
27
- *
28
- * @example
29
- * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
30
- * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
31
- * //=> Sun Sep 07 2014 23:59:59.999
32
- */
33
- function endOfWeek(date, options) {
34
- const defaultOptions = getDefaultOptions();
35
- const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
36
- const _date = toDate(date);
37
- const day = _date.getDay();
38
- const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
39
- _date.setDate(_date.getDate() + diff);
40
- _date.setHours(23, 59, 59, 999);
41
- return _date;
42
- }
43
- //#endregion
44
- export { endOfWeek as default };
@@ -1,357 +0,0 @@
1
- const require_toDate = require("./toDate.cjs");
2
- const require_defaultOptions = require("./_lib/defaultOptions.cjs");
3
- const require_isValid = require("./isValid.cjs");
4
- const require_en_US = require("./locale/en-US.cjs");
5
- const require_formatters = require("./_lib/format/formatters.cjs");
6
- const require_longFormatters = require("./_lib/format/longFormatters.cjs");
7
- const require_protectedTokens = require("./_lib/protectedTokens.cjs");
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 = require_defaultOptions.getDefaultOptions();
305
- const locale = options?.locale ?? defaultOptions.locale ?? require_en_US.default;
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 = require_toDate.default(date);
309
- if (!require_isValid.default(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 = require_longFormatters.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 (require_formatters.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 && require_protectedTokens.isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && require_protectedTokens.isProtectedDayOfYearToken(token)) require_protectedTokens.warnOrThrowProtectedError(token, formatStr, String(date));
347
- const formatter = require_formatters.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
- exports.default = format;