fix(time): bucket every date-render in the user's timezone (PMS-360) #232
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/mokosh-apps!232
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pms-360-spa-timezone-date-bucketing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Date-bucketed surfaces disagreed about which day an instant belongs to: Time Entries and Timesheet bucketed via UTC, Calendar and Dispatch used browser-local time, so a time entry logged at 23:30 Pacific stamped UTC=Jun 16 showed on Jun 15 in some views and Jun 16 in others. Same hour, two days. The fix is a single source of truth: the active user's users.timezone (PMS-253 made this column user-configurable), threaded through every date-bucket call site.
Adds
utils::datetime::user_local_date(dt, tz)anduser_today(tz)on top of a new chrono-tz dependency, plus auser_timezone()AuthContext reader that falls back to UTC when the context is absent or the preference is empty (matches the server-sidecanonical_tz_nameintroduced by the mokosh-server PMS-360 PR so the two crates agree on the fallback).Switched call sites:
today_real(was Local::now), DispatchBoardtoday_real(same).Unit tests pin the regression directly: a 23:30 Pacific instant buckets to Jun 15 in Los Angeles tz / Jun 16 in UTC; a Los Angeles viewer and a London viewer disagree about the day for the same instant (PMS-360 AC #1, #2); the fallback maps empty / stale / unknown tz strings to UTC.
Server-side dashboard trend bucketing landed separately on mokosh-server (PR #260 / commit e56be90); this PR is the SPA companion the server commit message called out as required follow-up.
Out of scope: no chrono-tz call sites in the server-computed dashboard widgets (those buckets come from the server already), no change to PMS-253 absolute datetime display (those still render through the existing browser-local
format_user_datetime).#PMS-360
Pull request closed