From ceff5914738bf2656875fd96e13eaf58c12e1482 Mon Sep 17 00:00:00 2001 From: smslc Date: Sun, 19 Jul 2026 06:18:09 +0200 Subject: [PATCH] fix: normalize timestamps to user locale with formatDate Changes: - helpers.ts: pass undefined to toLocaleDateString instead of hardcoded 'en-US' - page.tsx: use formatDate() instead of raw toLocaleTimeString() Fixes inconsistent timezone display by letting the browser use the user's locale and timezone automatically. Also adds date context to event timestamps (was showing only time, now shows date + time). --- frontend/src/app/markets/[id]/page.tsx | 4 ++-- frontend/src/utils/helpers.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/markets/[id]/page.tsx b/frontend/src/app/markets/[id]/page.tsx index 5ae3a63..042b96c 100644 --- a/frontend/src/app/markets/[id]/page.tsx +++ b/frontend/src/app/markets/[id]/page.tsx @@ -7,7 +7,7 @@ import { useWallet } from "@/hooks/useWallet"; import { useToken } from "@/hooks/useToken"; import { pollMarketEvents } from "@/services/events"; import { getXlmBalance } from "@/services/soroban"; -import { displayXLM, formatXLM, calculatePayout, truncateAddress } from "@/utils/helpers"; +import { displayXLM, formatXLM, calculatePayout, truncateAddress, formatDate } from "@/utils/helpers"; import { WIN_POINTS, LOSE_POINTS, @@ -319,7 +319,7 @@ export default function MarketDetailPage({ - {new Date(evt.timestamp * 1000).toLocaleTimeString()} + {formatDate(evt.timestamp)} ))} diff --git a/frontend/src/utils/helpers.ts b/frontend/src/utils/helpers.ts index 4688130..e8d0a12 100644 --- a/frontend/src/utils/helpers.ts +++ b/frontend/src/utils/helpers.ts @@ -78,7 +78,7 @@ export function timeUntil(timestamp: number): string { * Format a Unix timestamp to a locale-aware date string. */ export function formatDate(timestamp: number): string { - return new Date(timestamp * 1000).toLocaleDateString("en-US", { + return new Date(timestamp * 1000).toLocaleDateString(undefined, { year: "numeric", month: "short", day: "numeric",