mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-22 03:05:32 +02:00
fix(ui): handle +00:00 timezone in formatTimestamp
This commit is contained in:
parent
8ec369a704
commit
623d2a12cc
1 changed files with 1 additions and 2 deletions
|
|
@ -67,8 +67,7 @@ function sourceIcon(kind) {
|
||||||
|
|
||||||
function formatTimestamp(value) {
|
function formatTimestamp(value) {
|
||||||
if (!value) return "";
|
if (!value) return "";
|
||||||
// value is an ISO-8601 string from SQLite; display as "YYYY-MM-DD HH:MM"
|
const d = new Date(value);
|
||||||
const d = new Date(value.endsWith("Z") ? value : value + "Z");
|
|
||||||
if (isNaN(d)) return value;
|
if (isNaN(d)) return value;
|
||||||
const pad = (n) => String(n).padStart(2, "0");
|
const pad = (n) => String(n).padStart(2, "0");
|
||||||
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`;
|
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue