From 366d683d7bdec65148821e989763fd90ca696155 Mon Sep 17 00:00:00 2001 From: Djordje Vlaisavljevic Date: Sat, 17 Aug 2024 17:25:36 +0100 Subject: [PATCH] Fixed time not being converted properly ref https://linear.app/tryghost/issue/AP-131/show-nice-relative-timestamps --- .../src/utils/get-relative-timestamp.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/admin-x-activitypub/src/utils/get-relative-timestamp.ts b/apps/admin-x-activitypub/src/utils/get-relative-timestamp.ts index be70d68c24..b36554270f 100644 --- a/apps/admin-x-activitypub/src/utils/get-relative-timestamp.ts +++ b/apps/admin-x-activitypub/src/utils/get-relative-timestamp.ts @@ -3,12 +3,12 @@ export const getRelativeTimestamp = (date: Date): string => { const seconds = Math.floor((now.getTime() - date.getTime()) / 1000); let interval = Math.floor(seconds / 31536000); - if (interval > 1) { + if (interval >= 1) { return `${interval}y`; } interval = Math.floor(seconds / 2592000); - if (interval > 1) { + if (interval >= 1) { return `${interval}m`; } @@ -18,12 +18,12 @@ export const getRelativeTimestamp = (date: Date): string => { } interval = Math.floor(seconds / 3600); - if (interval > 1) { + if (interval >= 1) { return `${interval}h`; } interval = Math.floor(seconds / 60); - if (interval > 1) { + if (interval >= 1) { return `${interval}m`; }