From 3c1ecbbdfbd0851ec56dd7ce975e98b5e4d9b40f Mon Sep 17 00:00:00 2001 From: lif <1835304752@qq.com> Date: Wed, 17 Dec 2025 23:46:02 +0800 Subject: [PATCH] Fix timezone display in history page (#408) History page now respects the TZ environment variable for displaying timestamps. Also changed from toLocaleTimeString to toLocaleString to show both date and time for better clarity. Changes: - Add TIMEZONE export from env.ts using TZ environment variable - Pass timeZone option to toLocaleString in history.tsx --- src/helpers/env.ts | 2 ++ src/pages/history.tsx | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/helpers/env.ts b/src/helpers/env.ts index 4c8c067..53f6a8f 100644 --- a/src/helpers/env.ts +++ b/src/helpers/env.ts @@ -23,3 +23,5 @@ export const MAX_CONVERT_PROCESS = export const UNAUTHENTICATED_USER_SHARING = process.env.UNAUTHENTICATED_USER_SHARING?.toLowerCase() === "true" || false; + +export const TIMEZONE = process.env.TZ || undefined; diff --git a/src/pages/history.tsx b/src/pages/history.tsx index df3c150..54431ac 100644 --- a/src/pages/history.tsx +++ b/src/pages/history.tsx @@ -3,7 +3,7 @@ import { BaseHtml } from "../components/base"; import { Header } from "../components/header"; import db from "../db/db"; import { Filename, Jobs } from "../db/types"; -import { ALLOW_UNAUTHENTICATED, HIDE_HISTORY, LANGUAGE, WEBROOT } from "../helpers/env"; +import { ALLOW_UNAUTHENTICATED, HIDE_HISTORY, LANGUAGE, TIMEZONE, WEBROOT } from "../helpers/env"; import { userService } from "./user"; import { EyeIcon } from "../icons/eye"; import { DeleteIcon } from "../icons/delete"; @@ -129,7 +129,7 @@ export const history = new Elysia().use(userService).get( /> - {new Date(job.date_created).toLocaleTimeString(LANGUAGE)} + {new Date(job.date_created).toLocaleString(LANGUAGE, { timeZone: TIMEZONE })} {job.num_files} {job.finished_files} {job.status}