1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-07-21 18:55:36 +02:00

fix(ui): handle +00:00 timezone in formatTimestamp

This commit is contained in:
TheGeneralist 2026-06-23 22:39:21 +02:00
parent 8ec369a704
commit 623d2a12cc
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4

View file

@ -67,8 +67,7 @@ function sourceIcon(kind) {
function formatTimestamp(value) {
if (!value) return "";
// value is an ISO-8601 string from SQLite; display as "YYYY-MM-DD HH:MM"
const d = new Date(value.endsWith("Z") ? value : value + "Z");
const d = new Date(value);
if (isNaN(d)) return value;
const pad = (n) => String(n).padStart(2, "0");
return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`;