The client constant TODAY_STR and the bootstrap response's today field were both hardcoded to 2026-04-25, leaving date inputs in the New product, Audit, and Mark consumed flows seeded with a stale date and quietly staling out every "days since" / audit-overdue calculation across the app. TODAY_STR now resolves at module load from new Date() in local time, and bootstrap returns new Date().toISOString().slice(0, 10). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+9
-1
@@ -96,7 +96,15 @@ export const TYPES: TypeConfig[] = [
|
||||
{ id: "Vaporizer", kind: "discrete", auditMode: "presence", cadenceDays: 30, unit: "ct", weighable: false },
|
||||
];
|
||||
|
||||
export const TODAY_STR = "2026-04-25";
|
||||
// Local-time YYYY-MM-DD captured once at module load. Used as the default
|
||||
// value for date inputs and as the "today" anchor for days-since math.
|
||||
export const TODAY_STR = (() => {
|
||||
const d = new Date();
|
||||
const y = d.getFullYear();
|
||||
const m = String(d.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(d.getDate()).padStart(2, "0");
|
||||
return `${y}-${m}-${day}`;
|
||||
})();
|
||||
|
||||
// Helpers — match data.js DATA_HELPERS API
|
||||
export const helpers = {
|
||||
|
||||
Reference in New Issue
Block a user