Some changes for the notification layout & localize timestamps

This commit is contained in:
notiant
2025-11-23 00:51:04 +01:00
committed by GitHub
parent 1ff64efc64
commit e34248d5cb
14 changed files with 135 additions and 22 deletions
+16 -4
View File
@@ -100,11 +100,23 @@ Singleton {
return "";
const diff = Date.now() - date.getTime();
if (diff < 60000)
return "now";
return I18n.tr("notifications.time.now");
if (diff < 120000)
return I18n.tr("notifications.time.diffM");
if (diff < 3600000)
return `${Math.floor(diff / 60000)}m ago`;
return I18n.tr("notifications.time.diffMM", {
"diff": Math.floor(diff / 60000)
});
if (diff < 7200000)
return I18n.tr("notifications.time.diffH");
if (diff < 86400000)
return `${Math.floor(diff / 3600000)}h ago`;
return `${Math.floor(diff / 86400000)}d ago`;
return I18n.tr("notifications.time.diffHH", {
"diff": Math.floor(diff / 3600000)
});
if (diff < 172800000)
return I18n.tr("notifications.time.diffD");
return I18n.tr("notifications.time.diffDD", {
"diff": Math.floor(diff / 86400000)
});
}
}