fix: use explicit Eastern timezone for day boundary instead of system TZ
Build and Deploy / Build & Push (push) Successful in 2m50s
Build and Deploy / Build & Push (push) Successful in 2m50s
getTodayLocal() relied on system clock hours, which broke in the web container (TZ defaulting to UTC) — the day flipped at 11 PM EDT (3 AM UTC) instead of 3 AM Eastern. Now uses Intl.DateTimeFormat with an explicit America/New_York timezone. Also replaced all toISOString() date formatting with local-component helpers to avoid UTC conversion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
import { HomePageClient } from "@/components/HomePageClient";
|
||||
import { getTodayLocal } from "@/lib/env";
|
||||
import { getTodayLocal, formatDateLocal } from "@/lib/env";
|
||||
|
||||
const BACKEND_URL = process.env.BACKEND_URL ?? "http://localhost:3001";
|
||||
|
||||
@@ -12,13 +12,13 @@ function getWeekStart(param: string | undefined): string {
|
||||
const d = new Date(param + "T00:00:00");
|
||||
if (!isNaN(d.getTime())) {
|
||||
d.setDate(d.getDate() - d.getDay());
|
||||
return d.toISOString().slice(0, 10);
|
||||
return formatDateLocal(d);
|
||||
}
|
||||
}
|
||||
const todayIso = getTodayLocal();
|
||||
const d = new Date(todayIso + "T00:00:00");
|
||||
d.setDate(d.getDate() - d.getDay());
|
||||
return d.toISOString().slice(0, 10);
|
||||
return formatDateLocal(d);
|
||||
}
|
||||
|
||||
export default async function HomePage({ searchParams }: PageProps) {
|
||||
|
||||
Reference in New Issue
Block a user