dify/web/app/components/base/date-and-time-picker
lyzno1 7560e2427d
fix(timezone): support half-hour and 45-minute timezone offsets
Critical regression fix for convertTimezoneToOffsetStr:

Issues Fixed:
- Previous regex /^([+-]?\d{1,2}):00/ only matched :00 offsets
- This caused half-hour offsets (e.g., India +05:30) to return UTC+0
- Even if matched, parseInt only parsed hours, losing minute info

Changes:
- Update regex to /^([+-]?\d{1,2}):(\d{2})/ to match all offset formats
- Parse both hours and minutes separately
- Output format: "UTC+5:30" for non-zero minutes, "UTC+8" for whole hours
- Preserve leading zeros in minute part (e.g., "UTC+5:30" not "UTC+5:3")

Test Coverage:
- Added 8 comprehensive tests covering:
  * Default/invalid timezone handling
  * Whole hour offsets (positive/negative)
  * Zero offset (UTC)
  * Half-hour offsets (India +5:30, Australia +9:30)
  * 45-minute offset (Chatham +12:45)
  * Leading zero preservation in minutes

All 14 tests passing. Verified with timezone.json entries at lines 967, 1135, 1251.
2025-10-13 17:28:39 +08:00
..
calendar [Chore/Refactor] Add missing 'type' attribute on 'button' components (#26249) 2025-09-28 13:43:43 +08:00
common fix: type error in list-operator (#22803) 2025-07-24 12:21:20 +08:00
date-picker Merge remote-tracking branch 'origin/main' into feat/trigger 2025-09-30 08:00:16 +08:00
time-picker feat(time-picker): add showTimezone prop with comprehensive tests 2025-10-13 17:28:39 +08:00
utils fix(timezone): support half-hour and 45-minute timezone offsets 2025-10-13 17:28:39 +08:00
year-and-month-picker [Chore/Refactor] Add missing 'type' attribute on 'button' components (#26249) 2025-09-28 13:43:43 +08:00
hooks.ts feat: refactor date-and-time-picker to use custom dayjs utility and add timezone support (#15101) 2025-03-06 16:24:03 +08:00
types.ts feat(time-picker): add showTimezone prop with comprehensive tests 2025-10-13 17:28:39 +08:00