Add animated relative last-seen device timestamps
Build and Deploy Gateway / build-and-push (push) Successful in 15s
Build and Deploy Gateway / deploy (push) Successful in 7s

This commit is contained in:
2026-08-07 13:48:51 +03:00
parent 44367e0ef3
commit 76b75624b8
5 changed files with 84 additions and 13 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ export function formatTime(iso) {
export function formatLastSeen(iso, now = new Date()) {
const date = new Date(iso);
if (Number.isNaN(date.getTime())) return { label: "Нет данных", tooltip: "Нет данных" };
if (Number.isNaN(date.getTime())) return { label: "Нет данных", relative: "Нет данных", tooltip: "Нет данных" };
const current = new Date(now);
const day = (value) => Date.UTC(value.getFullYear(), value.getMonth(), value.getDate());
const daysAgo = Math.round((day(current) - day(date)) / 86_400_000);
@@ -62,5 +62,5 @@ export function formatLastSeen(iso, now = new Date()) {
hour: "2-digit",
minute: "2-digit",
});
return { label: `${dateLabel}, ${time}`, tooltip: `${full} (${relative})` };
return { label: `${dateLabel}, ${time}`, relative, tooltip: `${full} (${relative})` };
}