Add translation keys for "today", "yesterday" and "x days ago".
This commit is contained in:
parent
d39f260261
commit
5d05dfd019
4 changed files with 25 additions and 20 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue