This commit is contained in:
parent
9add35a428
commit
188513de70
@ -17,7 +17,7 @@ export function timeAgo(input: Date | number) {
|
|||||||
second: 1,
|
second: 1,
|
||||||
};
|
};
|
||||||
const secondsElapsed = (date.getTime() - Date.now()) / 1000;
|
const secondsElapsed = (date.getTime() - Date.now()) / 1000;
|
||||||
for (let key in ranges) {
|
for (const key in ranges) {
|
||||||
if (ranges[key] < Math.abs(secondsElapsed)) {
|
if (ranges[key] < Math.abs(secondsElapsed)) {
|
||||||
const delta = secondsElapsed / ranges[key];
|
const delta = secondsElapsed / ranges[key];
|
||||||
return formatter.format(Math.round(delta), key as Intl.RelativeTimeFormatUnit);
|
return formatter.format(Math.round(delta), key as Intl.RelativeTimeFormatUnit);
|
||||||
|
Reference in New Issue
Block a user