@iyulab/components 1.57.1 → 1.58.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/assets/locales/ar.json.js +12 -2
  3. package/dist/assets/locales/de.json.js +12 -2
  4. package/dist/assets/locales/en.json.js +12 -2
  5. package/dist/assets/locales/es.json.js +14 -2
  6. package/dist/assets/locales/fr.json.js +12 -2
  7. package/dist/assets/locales/id.json.js +12 -2
  8. package/dist/assets/locales/ja.json.js +14 -2
  9. package/dist/assets/locales/ko.json.js +14 -2
  10. package/dist/assets/locales/pt-BR.json.js +12 -2
  11. package/dist/assets/locales/ru.json.js +12 -2
  12. package/dist/assets/locales/th.json.js +14 -2
  13. package/dist/assets/locales/vi.json.js +12 -2
  14. package/dist/assets/locales/zh-CN.json.js +14 -2
  15. package/dist/assets/locales/zh-TW.json.js +14 -2
  16. package/dist/components/calendar/UCalendar.d.ts +4 -0
  17. package/dist/components/calendar/UCalendar.js +5 -4
  18. package/dist/components/calendar/dates.d.ts +4 -0
  19. package/dist/components/calendar/dates.js +5 -1
  20. package/dist/components/calendar/datetime.d.ts +14 -0
  21. package/dist/components/calendar/datetime.js +35 -0
  22. package/dist/components/calendar/picker.styles.js +35 -0
  23. package/dist/components/carousel/UCarousel.d.ts +7 -1
  24. package/dist/components/carousel/UCarousel.js +8 -1
  25. package/dist/components/date-picker/UDatePicker.d.ts +29 -1
  26. package/dist/components/date-picker/UDatePicker.js +89 -31
  27. package/dist/components/date-picker/UDatePicker.styles.js +0 -19
  28. package/dist/components/date-range-picker/UDateRangePicker.d.ts +69 -7
  29. package/dist/components/date-range-picker/UDateRangePicker.js +205 -34
  30. package/dist/index.js +2 -2
  31. package/dist/utilities/Locale.d.ts +2 -2
  32. package/dist/utilities/Locale.js +2 -2
  33. package/dist/utilities/format.d.ts +32 -4
  34. package/dist/utilities/format.js +131 -15
  35. package/package.json +1 -1
  36. package/skills/iyulab-components/references/components/carousel.md +3 -1
  37. package/skills/iyulab-components/references/components/date-picker.md +34 -2
  38. package/skills/iyulab-components/references/components/date-range-picker.md +52 -5
  39. package/skills/iyulab-components/references/utilities/locale.md +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,57 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.58.0] - 2026-10-03
4
+
5
+ ### Added
6
+
7
+ - **`confirm` on `u-date-picker` and `u-date-range-picker`: apply calendar picks with a button.** With
8
+ `confirm`, choosing a day, a time, a range, a preset, "Today" or "Clear value" in the calendar only
9
+ stages the choice; the footer adds Cancel and Apply. Apply commits it and fires `change` once;
10
+ Cancel, Escape or closing the calendar any other way drops it. Useful where a day and a time, or a
11
+ range adjusted several times, should reach the app as one change. Typing in the field still commits
12
+ on Enter or leaving it. New locale key `apply` in all built-in locales.
13
+ - **`isDateDisabled` on `u-date-picker` and `u-date-range-picker`: app rules for days that cannot be
14
+ chosen** — weekends, holidays, fully booked days. The function receives the ISO day; a disabled day
15
+ is drawn `aria-disabled`, cannot be picked, and turns "Today" (or a preset ending on it) off. A range
16
+ may run across a disabled day but cannot start or end on one. A typed or assigned value on a
17
+ disabled day reports `stepMismatch` with the new locale message `dateUnavailable`.
18
+
19
+ - **`u-date-range-picker mode="datetime"`: a period with start and end times.** Labelled start and end
20
+ time inputs sit under the calendar; each half of the value is a complete ISO-8601 `DateTimeOffset`
21
+ (`2026-10-01T09:00:00+09:00/2026-10-01T18:00:00+09:00`). The first range picked, and any preset,
22
+ covers its days whole (00:00–23:59); picking other days afterwards keeps the times. The text box reads
23
+ `2026-10-01 09:00 ~ 2026-10-31 18:00` and `2026-10-01 09:00 ~ 18:00`. New exports
24
+ `parseDateTimeRange` / `formatDateTimeRangeText`, new parts `calendar-time` / `time-input`, new
25
+ locale keys `startTime` / `endTime`.
26
+
27
+ - **`seconds` on `u-date-picker` and `u-date-range-picker` (`mode="datetime"`): times to the second.**
28
+ The time inputs show seconds, the text box reads and shows `HH:mm:ss`, and in the range picker a
29
+ whole day ends at `23:59:59`. Without it, times stay to the minute and typed seconds are dropped, as
30
+ before. `parseDateTime` / `parseDateTimeRange` take `seconds: true` to keep them, and
31
+ `formatDateTimeText` / `formatDateTimeRangeText` take a `seconds` argument to write them.
32
+
33
+ - **12-hour times are read.** `parseDateTime` and `parseDateTimeRange` — and so the text boxes of
34
+ `u-date-picker` / `u-date-range-picker` in `mode="datetime"`, and other readers built on them — take
35
+ `3:00 PM`, `3:00pm`, `p.m. 3:00` in every locale, and the locale's own words before or after the
36
+ time (`오후 3:00` in `ko`, `午後3:00` in `ja`, `下午 3:00` in `zh-CN` …; `12 AM` is midnight, `12 PM`
37
+ noon). The words come from the new locale keys `timeAm` / `timePm`. The value and the shown text
38
+ stay 24-hour.
39
+ - **`Locale.getValue(key, params, locale)`** resolves a message for a given locale (along its
40
+ fallback chain) instead of the active one.
41
+
42
+ ### Changed
43
+
44
+ - **`u-carousel[autoplay]` starts stopped for users who prefer reduced motion.** With
45
+ `prefers-reduced-motion: reduce`, rotation does not start on its own; the start button turns it on.
46
+ Turning the setting on while the page is open stops rotation.
47
+
48
+ ### Fixed
49
+
50
+ - **`u-date-picker mode="datetime"` takes the UTC offset of the chosen time, not of midnight.** On a
51
+ day the clocks change, a time after the change carried the offset from before it.
52
+ - **`u-date-picker` re-validates when `min` or `max` changes.** A value that a new bound put out of
53
+ range kept reporting valid until the value itself changed; `u-date-range-picker` already re-validated.
54
+
3
55
  ## [1.57.1] - 2026-10-03
4
56
 
5
57
  ### Fixed
@@ -53,6 +53,10 @@ var closeTab = "إغلاق علامة التبويب";
53
53
  var breadcrumb = "مسار التنقل";
54
54
  var confirm = "تأكيد";
55
55
  var cancel = "إلغاء";
56
+ var apply = "تطبيق";
57
+ var dateUnavailable = "هذا التاريخ غير متاح";
58
+ var startTime = "وقت البدء";
59
+ var endTime = "وقت الانتهاء";
56
60
  var ar_default = {
57
61
  valueMissing,
58
62
  badInput,
@@ -107,7 +111,13 @@ var ar_default = {
107
111
  closeTab,
108
112
  breadcrumb,
109
113
  confirm,
110
- cancel
114
+ cancel,
115
+ apply,
116
+ dateUnavailable,
117
+ startTime,
118
+ endTime,
119
+ timeAm: "ص",
120
+ timePm: "م"
111
121
  };
112
122
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, ar_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
123
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, ar_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,10 @@ var closeTab = "Tab schließen";
53
53
  var breadcrumb = "Navigationspfad";
54
54
  var confirm = "Bestätigen";
55
55
  var cancel = "Abbrechen";
56
+ var apply = "Übernehmen";
57
+ var dateUnavailable = "Dieses Datum ist nicht verfügbar";
58
+ var startTime = "Startzeit";
59
+ var endTime = "Endzeit";
56
60
  var de_default = {
57
61
  valueMissing,
58
62
  badInput,
@@ -107,7 +111,13 @@ var de_default = {
107
111
  closeTab,
108
112
  breadcrumb,
109
113
  confirm,
110
- cancel
114
+ cancel,
115
+ apply,
116
+ dateUnavailable,
117
+ startTime,
118
+ endTime,
119
+ timeAm: "AM",
120
+ timePm: "PM"
111
121
  };
112
122
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, de_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
123
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, de_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,10 @@ var closeTab = "Close tab";
53
53
  var breadcrumb = "Breadcrumb";
54
54
  var confirm = "Confirm";
55
55
  var cancel = "Cancel";
56
+ var apply = "Apply";
57
+ var dateUnavailable = "This date is not available";
58
+ var startTime = "Start time";
59
+ var endTime = "End time";
56
60
  var en_default = {
57
61
  valueMissing,
58
62
  badInput,
@@ -107,7 +111,13 @@ var en_default = {
107
111
  closeTab,
108
112
  breadcrumb,
109
113
  confirm,
110
- cancel
114
+ cancel,
115
+ apply,
116
+ dateUnavailable,
117
+ startTime,
118
+ endTime,
119
+ timeAm: "AM",
120
+ timePm: "PM"
111
121
  };
112
122
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, en_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
123
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, en_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -52,6 +52,12 @@ var closeTab = "Cerrar pestaña";
52
52
  var breadcrumb = "Ruta de navegación";
53
53
  var confirm = "Confirmar";
54
54
  var cancel = "Cancelar";
55
+ var apply = "Aplicar";
56
+ var dateUnavailable = "Esta fecha no está disponible";
57
+ var startTime = "Hora de inicio";
58
+ var endTime = "Hora de fin";
59
+ var timeAm = "a.m.";
60
+ var timePm = "p.m.";
55
61
  var es_default = {
56
62
  valueMissing,
57
63
  badInput,
@@ -106,7 +112,13 @@ var es_default = {
106
112
  closeTab,
107
113
  breadcrumb,
108
114
  confirm,
109
- cancel
115
+ cancel,
116
+ apply,
117
+ dateUnavailable,
118
+ startTime,
119
+ endTime,
120
+ timeAm,
121
+ timePm
110
122
  };
111
123
  //#endregion
112
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, es_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
124
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, es_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,10 @@ var closeTab = "Fermer l'onglet";
53
53
  var breadcrumb = "Fil d'Ariane";
54
54
  var confirm = "Confirmer";
55
55
  var cancel = "Annuler";
56
+ var apply = "Appliquer";
57
+ var dateUnavailable = "Cette date n'est pas disponible";
58
+ var startTime = "Heure de début";
59
+ var endTime = "Heure de fin";
56
60
  var fr_default = {
57
61
  valueMissing,
58
62
  badInput,
@@ -107,7 +111,13 @@ var fr_default = {
107
111
  closeTab,
108
112
  breadcrumb,
109
113
  confirm,
110
- cancel
114
+ cancel,
115
+ apply,
116
+ dateUnavailable,
117
+ startTime,
118
+ endTime,
119
+ timeAm: "AM",
120
+ timePm: "PM"
111
121
  };
112
122
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, fr_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
123
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, fr_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,10 @@ var closeTab = "Tutup tab";
53
53
  var breadcrumb = "Navigasi remah roti";
54
54
  var confirm = "Konfirmasi";
55
55
  var cancel = "Batal";
56
+ var apply = "Terapkan";
57
+ var dateUnavailable = "Tanggal ini tidak tersedia";
58
+ var startTime = "Waktu mulai";
59
+ var endTime = "Waktu selesai";
56
60
  var id_default = {
57
61
  valueMissing,
58
62
  badInput,
@@ -107,7 +111,13 @@ var id_default = {
107
111
  closeTab,
108
112
  breadcrumb,
109
113
  confirm,
110
- cancel
114
+ cancel,
115
+ apply,
116
+ dateUnavailable,
117
+ startTime,
118
+ endTime,
119
+ timeAm: "AM",
120
+ timePm: "PM"
111
121
  };
112
122
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, id_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
123
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, id_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -52,6 +52,12 @@ var remove = "削除";
52
52
  var closeTab = "タブを閉じる";
53
53
  var breadcrumb = "パンくずリスト";
54
54
  var cancel = "キャンセル";
55
+ var apply = "適用";
56
+ var dateUnavailable = "この日付は選択できません";
57
+ var startTime = "開始時刻";
58
+ var endTime = "終了時刻";
59
+ var timeAm = "午前";
60
+ var timePm = "午後";
55
61
  var ja_default = {
56
62
  valueMissing,
57
63
  badInput,
@@ -106,7 +112,13 @@ var ja_default = {
106
112
  closeTab,
107
113
  breadcrumb,
108
114
  confirm: "OK",
109
- cancel
115
+ cancel,
116
+ apply,
117
+ dateUnavailable,
118
+ startTime,
119
+ endTime,
120
+ timeAm,
121
+ timePm
110
122
  };
111
123
  //#endregion
112
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, copied, copy, decrement, ja_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
124
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, copied, copy, dateUnavailable, decrement, ja_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,12 @@ var closeTab = "탭 닫기";
53
53
  var breadcrumb = "탐색 경로";
54
54
  var confirm = "확인";
55
55
  var cancel = "취소";
56
+ var apply = "적용";
57
+ var dateUnavailable = "선택할 수 없는 날짜입니다";
58
+ var startTime = "시작 시간";
59
+ var endTime = "종료 시간";
60
+ var timeAm = "오전";
61
+ var timePm = "오후";
56
62
  var ko_default = {
57
63
  valueMissing,
58
64
  badInput,
@@ -107,7 +113,13 @@ var ko_default = {
107
113
  closeTab,
108
114
  breadcrumb,
109
115
  confirm,
110
- cancel
116
+ cancel,
117
+ apply,
118
+ dateUnavailable,
119
+ startTime,
120
+ endTime,
121
+ timeAm,
122
+ timePm
111
123
  };
112
124
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, ko_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
125
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, ko_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,10 @@ var closeTab = "Fechar aba";
53
53
  var breadcrumb = "Trilha de navegação";
54
54
  var confirm = "Confirmar";
55
55
  var cancel = "Cancelar";
56
+ var apply = "Aplicar";
57
+ var dateUnavailable = "Esta data não está disponível";
58
+ var startTime = "Hora de início";
59
+ var endTime = "Hora de término";
56
60
  var pt_BR_default = {
57
61
  valueMissing,
58
62
  badInput,
@@ -107,7 +111,13 @@ var pt_BR_default = {
107
111
  closeTab,
108
112
  breadcrumb,
109
113
  confirm,
110
- cancel
114
+ cancel,
115
+ apply,
116
+ dateUnavailable,
117
+ startTime,
118
+ endTime,
119
+ timeAm: "AM",
120
+ timePm: "PM"
111
121
  };
112
122
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, pt_BR_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
123
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, pt_BR_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,10 @@ var closeTab = "Закрыть вкладку";
53
53
  var breadcrumb = "Навигационная цепочка";
54
54
  var confirm = "Подтвердить";
55
55
  var cancel = "Отмена";
56
+ var apply = "Применить";
57
+ var dateUnavailable = "Эта дата недоступна";
58
+ var startTime = "Время начала";
59
+ var endTime = "Время окончания";
56
60
  var ru_default = {
57
61
  valueMissing,
58
62
  badInput,
@@ -107,7 +111,13 @@ var ru_default = {
107
111
  closeTab,
108
112
  breadcrumb,
109
113
  confirm,
110
- cancel
114
+ cancel,
115
+ apply,
116
+ dateUnavailable,
117
+ startTime,
118
+ endTime,
119
+ timeAm: "AM",
120
+ timePm: "PM"
111
121
  };
112
122
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, ru_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
123
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, ru_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,12 @@ var closeTab = "ปิดแท็บ";
53
53
  var breadcrumb = "เส้นทางการนำทาง";
54
54
  var confirm = "ยืนยัน";
55
55
  var cancel = "ยกเลิก";
56
+ var apply = "นำไปใช้";
57
+ var dateUnavailable = "ไม่สามารถเลือกวันที่นี้ได้";
58
+ var startTime = "เวลาเริ่มต้น";
59
+ var endTime = "เวลาสิ้นสุด";
60
+ var timeAm = "ก่อนเที่ยง";
61
+ var timePm = "หลังเที่ยง";
56
62
  var th_default = {
57
63
  valueMissing,
58
64
  badInput,
@@ -107,7 +113,13 @@ var th_default = {
107
113
  closeTab,
108
114
  breadcrumb,
109
115
  confirm,
110
- cancel
116
+ cancel,
117
+ apply,
118
+ dateUnavailable,
119
+ startTime,
120
+ endTime,
121
+ timeAm,
122
+ timePm
111
123
  };
112
124
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, th_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
125
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, th_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,10 @@ var closeTab = "Đóng tab";
53
53
  var breadcrumb = "Đường dẫn điều hướng";
54
54
  var confirm = "Xác nhận";
55
55
  var cancel = "Hủy";
56
+ var apply = "Áp dụng";
57
+ var dateUnavailable = "Ngày này không khả dụng";
58
+ var startTime = "Giờ bắt đầu";
59
+ var endTime = "Giờ kết thúc";
56
60
  var vi_default = {
57
61
  valueMissing,
58
62
  badInput,
@@ -107,7 +111,13 @@ var vi_default = {
107
111
  closeTab,
108
112
  breadcrumb,
109
113
  confirm,
110
- cancel
114
+ cancel,
115
+ apply,
116
+ dateUnavailable,
117
+ startTime,
118
+ endTime,
119
+ timeAm: "SA",
120
+ timePm: "CH"
111
121
  };
112
122
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, vi_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
123
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, vi_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,12 @@ var closeTab = "关闭标签页";
53
53
  var breadcrumb = "面包屑导航";
54
54
  var confirm = "确定";
55
55
  var cancel = "取消";
56
+ var apply = "应用";
57
+ var dateUnavailable = "该日期不可选";
58
+ var startTime = "开始时间";
59
+ var endTime = "结束时间";
60
+ var timeAm = "上午";
61
+ var timePm = "下午";
56
62
  var zh_CN_default = {
57
63
  valueMissing,
58
64
  badInput,
@@ -107,7 +113,13 @@ var zh_CN_default = {
107
113
  closeTab,
108
114
  breadcrumb,
109
115
  confirm,
110
- cancel
116
+ cancel,
117
+ apply,
118
+ dateUnavailable,
119
+ startTime,
120
+ endTime,
121
+ timeAm,
122
+ timePm
111
123
  };
112
124
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, zh_CN_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
125
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, zh_CN_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -53,6 +53,12 @@ var closeTab = "關閉分頁";
53
53
  var breadcrumb = "麵包屑導覽";
54
54
  var confirm = "確定";
55
55
  var cancel = "取消";
56
+ var apply = "套用";
57
+ var dateUnavailable = "此日期無法選取";
58
+ var startTime = "開始時間";
59
+ var endTime = "結束時間";
60
+ var timeAm = "上午";
61
+ var timePm = "下午";
56
62
  var zh_TW_default = {
57
63
  valueMissing,
58
64
  badInput,
@@ -107,7 +113,13 @@ var zh_TW_default = {
107
113
  closeTab,
108
114
  breadcrumb,
109
115
  confirm,
110
- cancel
116
+ cancel,
117
+ apply,
118
+ dateUnavailable,
119
+ startTime,
120
+ endTime,
121
+ timeAm,
122
+ timePm
111
123
  };
112
124
  //#endregion
113
- export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, decrement, zh_TW_default as default, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
125
+ export { alertError, alertInfo, alertMessage, alertNotice, alertSuccess, alertWarning, apply, badInput, breadcrumb, cancel, chooseDate, chooseDateRange, chooseFile, clear, close, closeTab, confirm, copied, copy, dateUnavailable, decrement, zh_TW_default as default, endTime, filesSelected, goToSlide, hidePassword, increment, last30Days, last7Days, lastMonth, lastWeek, nextMonth, nextSlide, noFileChosen, patternMismatch, previousMonth, previousSlide, quickRanges, rangeOverflow, rangeStartChosen, rangeUnderflow, remove, resizePanels, search, showPassword, startSlideRotation, startTime, stepMismatch, stopSlideRotation, thisMonth, thisWeek, thisYear, time, timeAm, timePm, today, tooLong, tooShort, typeMismatch, valueMissing, yesterday };
@@ -1,5 +1,6 @@
1
1
  import { PropertyValues } from 'lit';
2
2
  import { UElement } from '../UElement.js';
3
+ import { DateDisabledFn } from './dates.js';
3
4
  export interface CalendarDaySelectDetail {
4
5
  /** The chosen day as ISO `YYYY-MM-DD`. */
5
6
  date: string;
@@ -57,6 +58,9 @@ export declare class UCalendar extends UElement {
57
58
  min?: string;
58
59
  /** Latest selectable day (ISO), inclusive. */
59
60
  max?: string;
61
+ /** App rule for days that cannot be chosen (ISO in, `true` = unavailable) — drawn and refused like
62
+ * a day outside `min`/`max`. */
63
+ isDateDisabled?: DateDisabledFn;
60
64
  /** How many consecutive months to show side by side. */
61
65
  visibleMonths: number;
62
66
  /** First visible month (always the 1st of a month). */
@@ -4,7 +4,7 @@ import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm
4
4
  import { Locale } from "../../utilities/Locale.js";
5
5
  import "../icon-button/UIconButton.js";
6
6
  import { formatDate } from "../../utilities/format.js";
7
- import { addDays, addMonths, daysInMonth, isOutOfRange, isSameDay, monthDiff, parseISODate, startOfMonth, toISODate } from "./dates.js";
7
+ import { addDays, addMonths, daysInMonth, isDayUnavailable, isSameDay, monthDiff, parseISODate, startOfMonth, toISODate } from "./dates.js";
8
8
  import { styles } from "./UCalendar.styles.js";
9
9
  import { html } from "lit";
10
10
  import { customElement, property, state } from "lit/decorators.js";
@@ -139,7 +139,7 @@ var UCalendar = class UCalendar extends UElement {
139
139
  if (this.start && this.end) return ordered(parseISODate(this.start), parseISODate(this.end));
140
140
  }
141
141
  renderDay(date, range) {
142
- const outOfRange = isOutOfRange(date, this.min, this.max);
142
+ const unavailable = isDayUnavailable(date, this.min, this.max, this.isDateDisabled);
143
143
  const t = date.getTime();
144
144
  const inRange = !!range && t >= range[0].getTime() && t <= range[1].getTime();
145
145
  const selected = this.selection === "range" ? this.anchor ? isSameDay(date, this.anchor) : inRange : this.value ? isSameDay(date, parseISODate(this.value)) : false;
@@ -149,7 +149,7 @@ var UCalendar = class UCalendar extends UElement {
149
149
  data-iso=${toISODate(date)}
150
150
  tabindex=${isSameDay(date, this.focusedDate) ? 0 : -1}
151
151
  aria-selected=${selected}
152
- aria-disabled=${outOfRange}
152
+ aria-disabled=${unavailable}
153
153
  ?data-today=${isSameDay(date, /* @__PURE__ */ new Date())}
154
154
  ?data-in-range=${inRange}
155
155
  ?data-range-start=${!!range && isSameDay(date, range[0])}
@@ -170,7 +170,7 @@ var UCalendar = class UCalendar extends UElement {
170
170
  return this.renderRoot.querySelector(`button.day[data-iso="${toISODate(date)}"]`);
171
171
  }
172
172
  activate(date) {
173
- if (isOutOfRange(date, this.min, this.max)) return;
173
+ if (isDayUnavailable(date, this.min, this.max, this.isDateDisabled)) return;
174
174
  if (this.selection !== "range") {
175
175
  this.fire("day-select", { detail: { date: toISODate(date) } });
176
176
  return;
@@ -210,6 +210,7 @@ __decorate([property({ type: String }), __decorateMetadata("design:type", String
210
210
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UCalendar.prototype, "end", void 0);
211
211
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UCalendar.prototype, "min", void 0);
212
212
  __decorate([property({ type: String }), __decorateMetadata("design:type", String)], UCalendar.prototype, "max", void 0);
213
+ __decorate([property({ attribute: false }), __decorateMetadata("design:type", Object)], UCalendar.prototype, "isDateDisabled", void 0);
213
214
  __decorate([property({
214
215
  type: Number,
215
216
  attribute: "visible-months"
@@ -9,5 +9,9 @@ export declare function addDays(date: Date, delta: number): Date;
9
9
  export declare function daysInMonth(date: Date): number;
10
10
  /** 두 날의 달 차이(`b` 가 `a` 보다 몇 달 뒤인가). 일자는 무시한다. */
11
11
  export declare function monthDiff(a: Date, b: Date): number;
12
+ /** 앱이 정하는 날짜별 비활성 규칙 — ISO `YYYY-MM-DD` 를 받아 고를 수 없으면 `true`. */
13
+ export type DateDisabledFn = (date: string) => boolean;
14
+ /** 고를 수 없는 날인가 — `min`/`max` 밖이거나 앱 규칙이 막았다. */
15
+ export declare function isDayUnavailable(date: Date, min?: string, max?: string, isDateDisabled?: DateDisabledFn): boolean;
12
16
  /** `min`/`max`(ISO 날짜, 둘 다 선택)를 벗어나는가 — 경계일은 포함이다. */
13
17
  export declare function isOutOfRange(date: Date, min?: string, max?: string): boolean;
@@ -27,6 +27,10 @@ function daysInMonth(date) {
27
27
  function monthDiff(a, b) {
28
28
  return (b.getFullYear() - a.getFullYear()) * 12 + (b.getMonth() - a.getMonth());
29
29
  }
30
+ /** 고를 수 없는 날인가 — `min`/`max` 밖이거나 앱 규칙이 막았다. */
31
+ function isDayUnavailable(date, min, max, isDateDisabled) {
32
+ return isOutOfRange(date, min, max) || !!isDateDisabled?.(toISODate(date));
33
+ }
30
34
  /** `min`/`max`(ISO 날짜, 둘 다 선택)를 벗어나는가 — 경계일은 포함이다. */
31
35
  function isOutOfRange(date, min, max) {
32
36
  if (min && date.getTime() < parseISODate(min).getTime()) return true;
@@ -34,4 +38,4 @@ function isOutOfRange(date, min, max) {
34
38
  return false;
35
39
  }
36
40
  //#endregion
37
- export { addDays, addMonths, daysInMonth, isOutOfRange, isSameDay, monthDiff, parseISODate, startOfMonth, toISODate };
41
+ export { addDays, addMonths, daysInMonth, isDayUnavailable, isOutOfRange, isSameDay, monthDiff, parseISODate, startOfMonth, toISODate };
@@ -0,0 +1,14 @@
1
+ /** `±HH:mm` for the browser's local timezone at `date` (DST-aware — recomputed per date,
2
+ * not cached — `getTimezoneOffset()`'s sign is the inverse of the ISO-8601 offset sign). */
3
+ export declare function localOffset(date: Date): string;
4
+ /** ISO day + `HH:mm` or `HH:mm:ss` → `YYYY-MM-DDTHH:mm:ss±HH:mm` (the offset of that local day and time). */
5
+ export declare function toDateTimeOffset(day: string, time: string): string;
6
+ /** Splits a value into its ISO day and its time — `HH:mm`, or `HH:mm:ss` with `seconds`
7
+ * (`00:00` when there is no time part). */
8
+ export declare function splitDateTime(value: string, seconds?: boolean): {
9
+ day: string;
10
+ time: string;
11
+ };
12
+ /** `HH:mm[:ss]` → `HH:mm`, or `HH:mm:ss` with `seconds` (`:00` added when missing). A time input
13
+ * with a seconds step may report `14:30` for `14:30:00`, so both shapes come in. */
14
+ export declare function normalizeTime(time: string, seconds: boolean): string;
@@ -0,0 +1,35 @@
1
+ import { parseISODate } from "./dates.js";
2
+ //#region src/components/calendar/datetime.ts
3
+ /** `±HH:mm` for the browser's local timezone at `date` (DST-aware — recomputed per date,
4
+ * not cached — `getTimezoneOffset()`'s sign is the inverse of the ISO-8601 offset sign). */
5
+ function localOffset(date) {
6
+ const minutes = -date.getTimezoneOffset();
7
+ const sign = minutes >= 0 ? "+" : "-";
8
+ const abs = Math.abs(minutes);
9
+ return `${sign}${String(Math.floor(abs / 60)).padStart(2, "0")}:${String(abs % 60).padStart(2, "0")}`;
10
+ }
11
+ /** ISO day + `HH:mm` or `HH:mm:ss` → `YYYY-MM-DDTHH:mm:ss±HH:mm` (the offset of that local day and time). */
12
+ function toDateTimeOffset(day, time) {
13
+ const [h, m, s = 0] = time.split(":").map(Number);
14
+ const local = parseISODate(day);
15
+ local.setHours(h, m, s);
16
+ return `${day}T${normalizeTime(time, true)}${localOffset(local)}`;
17
+ }
18
+ /** Splits a value into its ISO day and its time — `HH:mm`, or `HH:mm:ss` with `seconds`
19
+ * (`00:00` when there is no time part). */
20
+ function splitDateTime(value, seconds = false) {
21
+ const [day, rest] = value.split("T");
22
+ const match = rest?.match(/^\d{2}:\d{2}(?::\d{2})?/);
23
+ return {
24
+ day,
25
+ time: normalizeTime(match ? match[0] : "00:00", seconds)
26
+ };
27
+ }
28
+ /** `HH:mm[:ss]` → `HH:mm`, or `HH:mm:ss` with `seconds` (`:00` added when missing). A time input
29
+ * with a seconds step may report `14:30` for `14:30:00`, so both shapes come in. */
30
+ function normalizeTime(time, seconds) {
31
+ const hm = time.slice(0, 5);
32
+ return seconds ? `${hm}:${time.slice(6, 8) || "00"}` : hm;
33
+ }
34
+ //#endregion
35
+ export { localOffset, normalizeTime, splitDateTime, toDateTimeOffset };