Resolve #737 by new messagelist view per day

This commit is contained in:
the-djmaze 2022-12-22 17:15:54 +01:00
parent d8a64124f2
commit 8aa9d3009b
5 changed files with 57 additions and 24 deletions

View file

@ -78,7 +78,7 @@ export const
time = 0 < timeStampInUTC ? Math.min(now, timeStampInUTC * 1000) : (0 === timeStampInUTC ? now : 0);
if (31536000000 < time) {
const m = new Date(time);
const m = new Date(time), h = LanguageStore.hourCycle();
switch (formatStr) {
case 'FROMNOW':
return m.fromNow();
@ -88,17 +88,17 @@ export const
const mt = m.getTime(), date = new Date,
dt = date.setHours(0,0,0,0);
if (mt > dt)
return i18n('MESSAGE_LIST/TODAY_AT', {TIME: m.format('LT',0,LanguageStore.hourCycle())});
return i18n('MESSAGE_LIST/TODAY_AT', {TIME: m.format('LT',0,h)});
if (mt > dt - 86400000)
return i18n('MESSAGE_LIST/YESTERDAY_AT', {TIME: m.format('LT',0,LanguageStore.hourCycle())});
return i18n('MESSAGE_LIST/YESTERDAY_AT', {TIME: m.format('LT',0,h)});
if (date.getFullYear() === m.getFullYear())
return m.format('d M');
return m.format('LL',0,LanguageStore.hourCycle());
return m.format('LL',0,h);
}
case 'FULL':
return m.format('LLL',0,LanguageStore.hourCycle());
return m.format('LLL',0,h);
default:
return m.format(formatStr,0,LanguageStore.hourCycle());
return m.format(formatStr,0,h);
}
}