A social knowledge tool for researchers built on ATProto

fix: incorrect relative time format when it's "now"

+4 -3
+2 -1
src/webapp/features/collections/components/collectionCard/CollectionCard.tsx
··· 23 23 export default function CollectionCard(props: Props) { 24 24 const router = useRouter(); 25 25 const { collection } = props; 26 + const time = getRelativeTime(collection.updatedAt); 26 27 const relativeUpdateDate = 27 - 'Updated ' + getRelativeTime(collection.updatedAt) + ' ago'; 28 + time === 'just now' ? `Updated ${time}` : `Updated ${time} ago`; 28 29 29 30 // TODO: add more sizes 30 31 return (
+2 -2
src/webapp/lib/utils/time.ts
··· 12 12 const seconds = Math.floor((Date.now() - date.getTime()) / 1000); 13 13 const interval = intervals.find((i) => i.seconds < seconds); 14 14 15 - if (!interval) return 'now'; 15 + if (!interval) return 'just now'; 16 16 const count = Math.floor(seconds / interval.seconds); 17 - if (count < 1) return 'now'; 17 + if (count < 1) return 'just now'; 18 18 19 19 return `${count}${interval.label}`; 20 20 };