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
This commit is contained in:
parent
911587ea68
commit
3c1ecbbdfb
2 changed files with 4 additions and 2 deletions
|
|
@ -23,3 +23,5 @@ export const MAX_CONVERT_PROCESS =
|
||||||
|
|
||||||
export const UNAUTHENTICATED_USER_SHARING =
|
export const UNAUTHENTICATED_USER_SHARING =
|
||||||
process.env.UNAUTHENTICATED_USER_SHARING?.toLowerCase() === "true" || false;
|
process.env.UNAUTHENTICATED_USER_SHARING?.toLowerCase() === "true" || false;
|
||||||
|
|
||||||
|
export const TIMEZONE = process.env.TZ || undefined;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { BaseHtml } from "../components/base";
|
||||||
import { Header } from "../components/header";
|
import { Header } from "../components/header";
|
||||||
import db from "../db/db";
|
import db from "../db/db";
|
||||||
import { Filename, Jobs } from "../db/types";
|
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 { userService } from "./user";
|
||||||
import { EyeIcon } from "../icons/eye";
|
import { EyeIcon } from "../icons/eye";
|
||||||
import { DeleteIcon } from "../icons/delete";
|
import { DeleteIcon } from "../icons/delete";
|
||||||
|
|
@ -129,7 +129,7 @@ export const history = new Elysia().use(userService).get(
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</td>
|
</td>
|
||||||
<td safe>{new Date(job.date_created).toLocaleTimeString(LANGUAGE)}</td>
|
<td safe>{new Date(job.date_created).toLocaleString(LANGUAGE, { timeZone: TIMEZONE })}</td>
|
||||||
<td>{job.num_files}</td>
|
<td>{job.num_files}</td>
|
||||||
<td class="max-sm:hidden">{job.finished_files}</td>
|
<td class="max-sm:hidden">{job.finished_files}</td>
|
||||||
<td safe>{job.status}</td>
|
<td safe>{job.status}</td>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue