Browse Source

fix the front page history incorrectly claiming yesterday is today for most of the day.

master
Gisle Aune 1 year ago
parent
commit
80e18c3c8a
  1. 8
      frontend/src/lib/utils/date.ts

8
frontend/src/lib/utils/date.ts

@ -56,12 +56,12 @@ export function formatWeekdayTitle(now: Date, time: Date | string | number): str
time = new Date(time);
}
const diff = Math.round((time.getTime() - now.getTime()) / (86400000));
if (diff === -1) {
const diff = Math.floor((time.getTime() - now.getTime()) / (86400000));
if (diff === 0) {
return "Today"
} else if (diff === -2) {
} else if (diff === -1) {
return "Yesterday"
} else if (diff >= -7) {
} else if (diff >= -6) {
return `${weekDay[time.getDay()]}`;
} else {
return formatWeekdayDate(time);

Loading…
Cancel
Save