Skip to content

fix(email): display host timezone in host-targeted emails#120

Merged
olivierlambert merged 2 commits into
mainfrom
fix/email-timezone-display
May 26, 2026
Merged

fix(email): display host timezone in host-targeted emails#120
olivierlambert merged 2 commits into
mainfrom
fix/email-timezone-display

Conversation

@olivierlambert
Copy link
Copy Markdown
Owner

Summary

  • Fixes Wrong time slot displayed on the cancelled email #119 — host emails were rendered in the guest's wall-clock time with no TZ label, so a Paris host reading a Los Angeles booking saw "07:00" and naturally assumed Paris time
  • Host-targeted emails (notification, approval request, booking confirmed, reminder, cancellation, reschedule request) now convert times into the host's own timezone and show a (TZ) suffix, e.g. 16:00 – 16:30 (Europe/Paris)
  • Guest cancellation and decline emails gained the (TZ) label they were missing — confirmation/pending already had it

Implementation

  • BookingDetails, CancellationDetails, RescheduleDetails get a new host_timezone: String field (empty string preserves legacy behavior)
  • Two helpers in src/email.rs: convert_time_between_tz (handles date rollover — e.g. LA 22:00 → Paris 07:00 next day) and host_time_display (returns (date, formatted_time))
  • 16 call sites in src/web/mod.rs, src/commands/booking.rs, src/commands/sync.rs populate host_timezone — mostly from the already-in-scope host_tz / stored_tz (event-type timezone via get_host_tz), with a couple of query extensions to fetch users.timezone
  • 6 new unit tests, including a regression test mirroring the LA→Paris scenario from Wrong time slot displayed on the cancelled email #119

Test plan

  • cargo build
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --check
  • cargo test (676 passing, including 6 new tests)
  • Manual: cancel a booking as a host whose timezone differs from the guest, confirm cancellation email shows host's local time

🤖 Generated with Claude Code

olivierlambert and others added 2 commits May 26, 2026 21:04
Times in host emails were rendered in the guest's wall-clock with no
TZ label, so a Paris host seeing a Los Angeles booking would read
"07:00" thinking it was Paris time. Now the host's emails show
"16:00 (Europe/Paris)" and the guest's cancellation/decline emails
gain the TZ label they were already missing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Review caught that two paths fed host-tz-stored times straight into
BookingDetails/RescheduleDetails (whose contract is guest-tz wall-clock):

- run_reminder_loop pulled start_at/end_at raw from the db and labeled
  them with guest_timezone. host_time_display then double-converted —
  a 16:00 Paris booking displayed as "01:00 next day" in the host
  reminder.
- guest_reschedule_booking extracted old_*_time the same way and mixed
  them with form-derived new_*_time. The "Previous" line in the host's
  reschedule-request email had wrong wall-clock.

Both now run through booking_strings_in_guest_tz first (matching
cancel/confirm/decline handlers). As a bonus this also fixes a
pre-existing latent bug where the guest reminder was already showing
host-tz wall-clock under a guest-tz label.

Side fixes:
- host_reschedule_booking switched from user.timezone to get_host_tz
  for consistency with the other 15 call sites.
- BookingDetails::host_timezone doc comment updated to reflect that
  most call sites pass the event-type tz (via get_host_tz), not
  users.timezone directly.
- New regression test stored_to_host_email_recovers_host_wall_clock
  pins the end-to-end pipeline: stored host-tz → guest-tz via
  booking_strings_in_guest_tz → host wall-clock via host_time_display.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@olivierlambert olivierlambert merged commit a8e7859 into main May 26, 2026
4 checks passed
@olivierlambert olivierlambert deleted the fix/email-timezone-display branch May 26, 2026 19:33
olivierlambert added a commit that referenced this pull request May 26, 2026
Patch release for #120 — host emails now display the host's wall-clock
with a TZ label, and the reminder/reschedule paths stopped feeding
host-tz-stored times into guest-tz-labeled struct fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong time slot displayed on the cancelled email

1 participant