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
..
2025-09-18 12:49:10 +08:00
2025-09-12 02:46:04 +09:00
2025-03-21 17:41:03 +08:00
2025-09-18 12:49:10 +08:00
2025-09-28 13:43:43 +08:00
2025-10-09 09:23:34 +08:00
2025-09-28 13:43:43 +08:00
2025-07-17 21:47:48 +08:00
2025-09-09 16:00:50 +08:00
2025-04-29 18:04:33 +08:00
2025-08-31 17:01:10 +08:00
2025-09-18 12:49:10 +08:00
2025-10-09 09:23:34 +08:00
2025-09-28 15:12:17 +08:00
2025-09-28 15:12:17 +08:00
2025-03-21 17:41:03 +08:00
2025-03-21 17:41:03 +08:00
2025-09-18 12:49:10 +08:00
2025-04-29 18:04:33 +08:00
2025-03-21 17:41:03 +08:00
2025-09-23 17:04:56 +08:00
2025-09-18 12:49:10 +08:00
2025-10-13 17:28:39 +08:00
2025-08-08 09:25:41 +08:00
2025-04-03 18:19:11 +08:00
2025-10-09 09:23:34 +08:00
2025-04-22 09:59:14 +08:00
2025-09-18 12:49:10 +08:00
2025-09-18 12:49:10 +08:00
2025-10-09 09:23:34 +08:00
2025-10-13 14:54:24 +08:00
2025-09-28 22:40:31 +08:00
2025-09-18 12:49:10 +08:00
2024-12-12 13:37:56 +08:00
2025-10-02 18:46:33 +08:00
2025-10-13 17:21:26 +08:00
2025-08-08 09:25:41 +08:00
2025-09-11 13:17:50 +08:00
2025-08-08 09:25:41 +08:00
2025-10-13 13:21:51 +08:00
2025-04-29 18:04:33 +08:00
2025-10-09 09:23:34 +08:00
2025-10-11 18:18:18 +08:00
2025-10-13 17:21:26 +08:00
2025-09-18 12:49:10 +08:00
2025-08-23 23:54:41 +08:00
2025-04-29 18:04:33 +08:00
2025-09-18 12:49:10 +08:00
2025-03-21 17:41:03 +08:00
2025-04-03 18:19:11 +08:00
2025-08-08 09:25:41 +08:00
2025-10-07 14:21:08 +08:00
2025-10-09 09:23:34 +08:00
2025-10-09 09:23:34 +08:00
2025-09-18 12:49:10 +08:00
2025-10-13 14:46:08 +08:00
2025-03-21 17:41:03 +08:00
2025-03-21 17:41:03 +08:00
2025-09-18 12:49:10 +08:00
2025-04-14 15:45:23 +08:00
2025-09-29 20:35:55 +09:00
2025-10-09 09:23:34 +08:00
2025-09-18 12:49:10 +08:00
2025-10-09 09:23:34 +08:00
2025-09-18 15:57:33 +08:00
2025-08-08 09:25:41 +08:00
2025-09-18 12:49:10 +08:00
2025-09-18 12:49:10 +08:00
2025-03-21 17:41:03 +08:00
2025-03-21 17:41:03 +08:00
2025-09-18 12:49:10 +08:00
2025-04-29 18:04:33 +08:00
2025-09-24 15:53:59 +08:00
2025-09-18 12:49:10 +08:00
2025-10-10 15:16:00 +08:00
2024-12-26 12:01:51 +08:00
2025-08-08 09:25:41 +08:00
2025-09-18 12:49:10 +08:00
2025-03-21 17:41:03 +08:00
2025-04-03 18:19:11 +08:00
2025-03-21 17:41:03 +08:00
2025-09-23 17:04:56 +08:00
2025-08-08 09:25:41 +08:00
2025-06-24 09:10:30 +08:00
2025-09-29 20:35:55 +09:00
2025-08-09 22:41:42 +08:00
2025-03-21 17:41:03 +08:00
2025-08-08 09:25:41 +08:00
2025-09-18 12:49:10 +08:00
2025-10-09 09:23:34 +08:00
2025-03-21 17:41:03 +08:00
2025-09-18 12:49:10 +08:00
2025-10-13 17:28:39 +08:00
2025-09-28 13:43:43 +08:00
2025-08-27 15:07:28 +08:00
2025-09-28 13:43:43 +08:00
2025-10-09 09:23:34 +08:00
2025-04-06 17:56:08 +08:00
2025-09-11 13:17:50 +08:00
2025-06-09 15:44:49 +08:00
2025-03-21 17:41:03 +08:00
2025-09-28 13:43:43 +08:00
2025-05-14 09:06:14 +08:00