diff --git a/src/webapp/features/collections/components/collectionCard/CollectionCard.tsx b/src/webapp/features/collections/components/collectionCard/CollectionCard.tsx index 69143615..b5e285da 100644 --- a/src/webapp/features/collections/components/collectionCard/CollectionCard.tsx +++ b/src/webapp/features/collections/components/collectionCard/CollectionCard.tsx @@ -23,8 +23,9 @@ interface Props { export default function CollectionCard(props: Props) { const router = useRouter(); const { collection } = props; + const time = getRelativeTime(collection.updatedAt); const relativeUpdateDate = - 'Updated ' + getRelativeTime(collection.updatedAt) + ' ago'; + time === 'just now' ? `Updated ${time}` : `Updated ${time} ago`; // TODO: add more sizes return ( diff --git a/src/webapp/lib/utils/time.ts b/src/webapp/lib/utils/time.ts index 417bd926..6deba3b0 100644 --- a/src/webapp/lib/utils/time.ts +++ b/src/webapp/lib/utils/time.ts @@ -12,9 +12,9 @@ export const getRelativeTime = (dateString: string) => { const seconds = Math.floor((Date.now() - date.getTime()) / 1000); const interval = intervals.find((i) => i.seconds < seconds); - if (!interval) return 'now'; + if (!interval) return 'just now'; const count = Math.floor(seconds / interval.seconds); - if (count < 1) return 'now'; + if (count < 1) return 'just now'; return `${count}${interval.label}`; };