Add translation keys for "today", "yesterday" and "x days ago".

This commit is contained in:
N-Pex 2022-04-21 09:48:10 +02:00
parent d39f260261
commit 5d05dfd019
4 changed files with 25 additions and 20 deletions

View file

@ -546,19 +546,15 @@ class Util {
return t2.diff(t1, 'day');
}
formatDay(timestamp) {
dayDiffToday(timestamp) {
var then = dayjs(timestamp).endOf('day');
var now = dayjs().endOf('day');
const dayDiff = now.diff(then, 'day');
if (dayDiff < 1) {
return "Today";
} else if (dayDiff < 2) {
return "Yesterday";
} else if (dayDiff < 7) {
return "" + dayDiff + " days ago";
} else {
return then.format('L');
}
return now.diff(then, 'day');
}
formatDay(timestamp) {
var then = dayjs(timestamp).endOf('day');
return then.format('L');
}
formatRecordDuration(ms) {