Format the panel and admin date and clock in the stored application timezone
The panel snapshot now carries the admin-saved `timezone` ("" when unset);
the coordinator threads it onto the household due-today sensor, and the
Party Board and Quest Log cards format their kicker, header and dock
date and clock in it, falling back to Home Assistant's zone only when
none is stored. The admin app loads the stored zone once
(AppTimezoneProvider) and uses it for completion clocks, History day
grouping, clocks and lateness, and "today" in Schedule, History and new
task defaults; Settings publishes a saved zone app-wide at once.
Resolves review finding TZ-001 (task 7e173881).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,8 +4,10 @@
|
||||
* Calendar dates ("YYYY-MM-DD") are parsed by their components and formatted
|
||||
* in UTC, so the printed day never shifts with the viewer's offset — unlike
|
||||
* `new Date("YYYY-MM-DD")`, which is UTC midnight and reads as the previous
|
||||
* day in negative-offset zones.
|
||||
* day in negative-offset zones. Instants are shown in the application
|
||||
* timezone (time/zone.ts).
|
||||
*/
|
||||
import { zoneOption } from "../time/zone";
|
||||
|
||||
const LOCALE = "en-US";
|
||||
|
||||
@@ -44,7 +46,11 @@ export function formatDueTime(hhmm: string): string {
|
||||
return format(date, { hour: "numeric", minute: "2-digit", timeZone: "UTC" });
|
||||
}
|
||||
|
||||
/** A UTC ISO timestamp shown as the viewer's local time, "7:04 AM". */
|
||||
export function formatClockTime(isoTimestamp: string): string {
|
||||
return format(new Date(isoTimestamp), { hour: "numeric", minute: "2-digit" });
|
||||
/** A UTC ISO timestamp shown as wall-clock time in `timeZone` ("" = browser), "7:04 AM". */
|
||||
export function formatClockTime(isoTimestamp: string, timeZone: string): string {
|
||||
return format(new Date(isoTimestamp), {
|
||||
hour: "numeric",
|
||||
minute: "2-digit",
|
||||
timeZone: zoneOption(timeZone),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user