mirror of
https://github.com/apricote/apricote.de.git
synced 2026-01-13 12:51:00 +00:00
fix: last update timer on listory page always showed "Just Now"
This commit is contained in:
parent
a87369c085
commit
c1feba9513
1 changed files with 3 additions and 3 deletions
|
|
@ -20,16 +20,16 @@
|
|||
return;
|
||||
}
|
||||
|
||||
const diffMs = date - new Date();
|
||||
const diffMs = new Date() - date;
|
||||
const hoursSince = diffMs / 1000 / 60 / 60;
|
||||
const daysSince = hoursSince / 24;
|
||||
|
||||
let formatted = "";
|
||||
|
||||
if (daysSince > 1) {
|
||||
formatted = formatter.format(daysSince, "days");
|
||||
formatted = formatter.format(-Math.round(daysSince), "days");
|
||||
} else if (hoursSince > 1) {
|
||||
formatted = formatter.format(daysSince, "hours");
|
||||
formatted = formatter.format(-Math.round(hoursSince), "hours");
|
||||
} else {
|
||||
formatted = "Just Now!";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue