Improve future date localized strings
This commit is contained in:
parent
caff432c0b
commit
1638f8e2f1
1 changed files with 4 additions and 4 deletions
|
@ -51,13 +51,13 @@ export function getTimeAgoStr(date: any, showFutureDate?: boolean, genericSecond
|
|||
return duration > 0 || (showFutureDate && duration * -1 > 0);
|
||||
});
|
||||
|
||||
// negative duration === it's a future date from now
|
||||
if (duration < 0 && showFutureDate) return __(moment(date).from(moment()));
|
||||
|
||||
// Strip off the ending 's' for the singular suffix
|
||||
if (duration === 1) suffix = suffix.replace(/s$/g, '');
|
||||
|
||||
if (duration <= 0) {
|
||||
// negative duration === it's a future date from now
|
||||
if (duration < 0 && showFutureDate) {
|
||||
str = suffix === 'seconds' ? 'in a few seconds' : 'in %duration% ' + suffix;
|
||||
} else if (duration <= 0) {
|
||||
str = 'Just now';
|
||||
} else {
|
||||
str = suffix === 'seconds' && genericSecondsString ? 'A few seconds ago' : '%duration% ' + suffix + ' ago';
|
||||
|
|
Loading…
Reference in a new issue