From 1247614eebd4f3b1005efe552de593fbfb0b019f Mon Sep 17 00:00:00 2001 From: Bryan Gin-ge Chen Date: Thu, 22 Oct 2026 11:55:25 -0400 Subject: [PATCH] fix(console): show prefs-page times in the browser's timezone A reviewer on CEST saw the prefs page's "Preferences saved at" time two hours behind. The view resolved a zone on the server (Zulip's zone, then core.User.timezone, then UTC) and validated the form inside timezone.override(), but rendered the template after leaving it. Django converts aware datetimes to the zone active at render time, so the page showed UTC times under the reviewer's zone name. away_until was shown in UTC but read back in the reviewer's zone, so saving the form unchanged moved it earlier by that zone's UTC offset. The prefs page was also the only reviewer-facing surface that picked a zone on the server; the rest of the console and the bot's Zulip messages show times in the reader's own zone. So instead of only moving the render, use the browser's zone here too. The server renders times in its default zone, and the form posts back the zone they are in, in a hidden `timezone` field. prefs_form.js rewrites each away_until from its stored instant (data-utc) into the browser's zone and sets that field to match, so the server always reads a time in the zone it was shown in. Rendering stays inside the override. A posted zone the server cannot load saves nothing rather than misreading the times. The "saved at" time is a