Add timezone preference and fix all date handling to be timezone-aware
Build and push image / build (push) Successful in 56s

Dates were computed using browser/server local time with no explicit timezone,
causing inconsistencies when server runs in UTC. Now all "today" computations
and date formatting use the user's chosen IANA timezone, persisted in
localStorage and selectable from Settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 22:30:01 -04:00
parent 946e96c3ea
commit 4044de7bfc
22 changed files with 165 additions and 85 deletions
+4 -3
View File
@@ -1,7 +1,8 @@
import { useEffect, useState } from "react";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import type { Bootstrap, Item } from "../../types.js";
import { TYPES, helpers, TODAY_STR, enrichItems } from "../../types.js";
import { TYPES, helpers, enrichItems } from "../../types.js";
import { getToday, getStoredTimezone } from "../../tz.js";
import { api } from "../../api.js";
import { Btn, Field, Input, Select } from "../primitives/index.js";
import { ScanField, type ScanResult } from "../ScanField.js";
@@ -40,7 +41,7 @@ export function AuditFlow({
.sort((a, b) => helpers.daysSinceCheck(b) - helpers.daysSinceCheck(a));
const [itemId, setItemId] = useState(initialItem?.id ?? "");
const [date, setDate] = useState(TODAY_STR);
const [date, setDate] = useState(getToday(getStoredTimezone()));
const [confirmedBy, setConfirmedBy] = useState<"asset" | "visual">("asset");
const item = allItems.find((i) => i.id === itemId);
@@ -51,7 +52,7 @@ export function AuditFlow({
if (i.kind === "discrete") {
return String(i.countLastAudit ?? i.countOriginal);
}
return helpers.estimatedRemaining(i, TODAY_STR).toFixed(2);
return helpers.estimatedRemaining(i, getToday(getStoredTimezone())).toFixed(2);
};
const [value, setValue] = useState<string>(initialValueFor(item));
const [error, setError] = useState<string | null>(null);