Dylan M. Taylor
e3169e5a61
collab/ui-egui: keep old UTC output past chrono's year range
...
`utc_date` (collab) and `date` (ui-egui) took `u64` seconds, which the old
hand-rolled civil-from-days code converted for the whole `u64` range. The
chrono rewrite used `from_timestamp(..).unwrap_or_default()`, so any instant
past chrono's own year limit (262143) silently became the epoch — changing
existing output. `u64::MAX` seconds, for example, used to read
`584554051223-11-09 07:00 UTC` / `Nov 9, 584554051223`, not 1970.
Fix: add a `utc_parts(days, sod, nanos)` helper per crate that moves the
instant into chrono's range by whole 400-year Gregorian cycles (146_097 days),
lets chrono do the month/day/time, and restores the real year afterwards.
chrono stays the only calendar logic; the cycle count just shifts the year, and
every `u64` day count fits in `i64` so the conversion is always exact (no epoch
fallback). Split seconds with `u64` arithmetic first to avoid the `i64` seconds
overflow near `u64::MAX`, matching the old code.
Tests now pin the old output instead of the epoch:
- collab utc_date(u64::MAX) == "584554051223-11-09 07:00 UTC"
(and utc_date(253_402_300_800) == "10000-01-01 00:00 UTC", already pinned)
- ui-egui date(253_402_300_800) == "Jan 1, 10000"
date(u64::MAX) == "Nov 9, 584554051223"
2026-10-22 07:12:29 -04:00
..
2026-10-14 16:53:33 +07:00
2026-10-17 10:49:01 +02:00
2026-10-19 20:51:47 +05:00
2026-10-19 22:39:23 +07:00
2026-10-18 00:36:36 +07:00
2026-10-11 12:45:38 +07:00
2026-10-12 02:30:25 +07:00
2026-10-15 10:52:47 +00:00
2026-10-15 18:34:23 +07:00
2026-10-17 23:25:51 +07:00
2026-10-15 21:09:19 +02:00
2026-10-20 15:27:27 +02:00
2026-10-20 00:05:51 +07:00
2026-10-15 14:15:35 +02:00
2026-10-19 19:43:58 +05:00
2026-10-20 21:04:04 +05:00
2026-10-19 20:51:47 +05:00
2026-10-20 16:18:13 +11:00
2026-10-16 15:05:00 +02:00
2026-10-18 15:20:15 -06:00
2026-10-20 21:04:04 +05:00
2026-10-15 08:10:19 -07:00
2026-10-15 08:10:19 -07:00
2026-10-13 00:29:41 +07:00
2026-10-13 00:29:41 +07:00
2026-10-17 16:18:57 +07:00
2026-10-11 16:21:16 +07:00
2026-10-10 23:29:17 +07:00
2026-10-19 20:51:47 +05:00
2026-10-20 01:43:53 +07:00
2026-10-15 23:06:31 +03:00
2026-10-17 18:34:38 -06:00
2026-10-17 18:34:38 -06:00
2026-10-13 00:29:41 +07:00
2026-10-20 04:45:45 +07:00
2026-10-10 13:03:09 +07:00
2026-10-17 23:44:41 +07:00
2026-10-20 00:45:56 +07:00
2026-10-11 16:21:16 +07:00
2026-10-10 23:53:05 +07:00
2026-10-13 13:36:54 +07:00
2026-10-14 01:02:45 -05:00
2026-10-15 13:54:07 +02:00
2026-10-16 01:35:37 +07:00
2026-10-20 00:45:56 +07:00
2026-10-19 20:51:47 +05:00
2026-10-22 07:12:29 -04:00
2026-10-20 15:27:27 +02:00
2026-10-20 15:27:27 +02:00
2026-10-20 04:38:28 +07:00
2026-10-20 02:33:25 +04:00
2026-10-20 01:43:40 +07:00
2026-10-20 15:29:27 +11:00
2026-10-18 01:41:15 +07:00
2026-10-18 19:32:46 +02:00
2026-10-17 14:21:29 +07:00
2026-10-20 21:28:09 -03:00
2026-10-15 21:48:25 +02:00
2026-10-11 23:10:41 +07:00
2026-10-19 11:50:07 +02:00
2026-10-18 01:49:02 +07:00
2026-10-20 21:28:09 -03:00
2026-10-19 23:58:26 +07:00
2026-10-21 16:21:38 +07:00
2026-10-15 12:09:40 +02:00
2026-10-12 17:54:18 +07:00
2026-10-12 19:42:28 +07:00
2026-10-17 13:19:13 -06:00
2026-10-13 01:41:14 +07:00
2026-10-12 19:42:28 +07:00
2026-10-12 19:42:28 +07:00
2026-10-11 09:29:30 +07:00
2026-10-12 17:54:18 +07:00
2026-10-20 04:38:28 +07:00
2026-10-20 04:58:31 +07:00
2026-10-10 14:04:17 +07:00
2026-10-17 10:49:01 +02:00
2026-10-17 16:36:24 +07:00
2026-10-20 16:18:13 +11:00
2026-10-17 22:06:03 +07:00
2026-10-18 00:22:21 +07:00
2026-10-13 01:41:14 +07:00
2026-10-18 01:49:21 +05:00
2026-10-14 10:32:44 +07:00
2026-10-19 23:58:26 +07:00
2026-10-17 15:20:08 +07:00
2026-10-17 15:49:01 +07:00
2026-10-10 22:21:53 +07:00
2026-10-13 00:29:41 +07:00
2026-10-17 16:13:47 +03:00
2026-10-15 19:14:46 +07:00
2026-10-20 15:27:27 +02:00
2026-10-11 23:10:41 +07:00
2026-10-12 04:41:28 +07:00
2026-10-12 17:54:18 +07:00
2026-10-17 10:49:01 +02:00
2026-10-10 16:16:35 +07:00
2026-10-13 13:36:54 +07:00
2026-10-13 13:36:54 +07:00
2026-10-17 13:19:13 -06:00
2026-10-12 05:28:53 +07:00
2026-10-10 09:48:29 +07:00
2026-10-13 13:36:54 +07:00
2026-10-16 14:16:44 +05:00
2026-10-19 20:51:47 +05:00
2026-10-20 01:34:10 +07:00
2026-10-19 12:50:43 +02:00
2026-10-15 13:02:30 -03:00
2026-10-20 04:39:04 +07:00
2026-10-10 22:21:53 +07:00
2026-10-16 14:16:44 +05:00
2026-10-15 10:04:09 -04:00
2026-10-17 08:17:28 +05:30
2026-10-20 04:45:44 +07:00
2026-10-10 13:03:09 +07:00
2026-10-16 02:03:46 +02:00
2026-10-15 22:15:58 +07:00
2026-10-11 16:21:16 +07:00
2026-10-15 13:54:04 -03:00
2026-10-15 21:57:53 +03:00
2026-10-19 23:49:03 +07:00
2026-10-19 23:49:03 +07:00
2026-10-15 19:04:53 +02:00
2026-10-15 13:54:04 -03:00
2026-10-17 15:03:28 +02:00
2026-10-20 04:58:31 +07:00
2026-10-14 22:23:51 +03:00
2026-10-15 12:26:22 +02:00
2026-10-19 20:51:47 +05:00
2026-10-19 23:37:27 +07:00
2026-10-14 10:58:17 -04:00
2026-10-14 10:34:14 +03:00
2026-10-20 04:57:20 +07:00
2026-10-19 14:23:04 +05:00
2026-10-20 01:13:35 +07:00
2026-10-15 19:28:46 +03:00
2026-10-19 20:51:47 +05:00
2026-10-20 00:23:14 +07:00
2026-10-20 00:23:14 +07:00
2026-10-20 04:45:44 +07:00
2026-10-14 20:01:53 -03:00
2026-10-16 01:36:24 +07:00
2026-10-14 18:21:08 +03:00
2026-10-20 16:18:13 +11:00
2026-10-14 12:35:06 -04:00
2026-10-15 19:20:32 +07:00
2026-10-11 10:04:25 +07:00
2026-10-15 13:54:04 -03:00
2026-10-18 16:08:12 +02:00
2026-10-20 05:58:56 +07:00
2026-10-11 18:20:38 +07:00
2026-10-17 21:04:46 +07:00
2026-10-17 20:48:35 +07:00
2026-10-15 10:04:09 -04:00