We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e739857 commit e95b550Copy full SHA for e95b550
frontend/src/lib/utils/time.ts
@@ -18,6 +18,10 @@ const RELATIVE_DIVISIONS: Array<{ amount: number; unit: Intl.RelativeTimeFormatU
18
];
19
20
export const formatRelativeTime = (from: Date, to = new Date()): string => {
21
+ if (isNaN(from.getTime()) || isNaN(to.getTime())) {
22
+ return 'Unknown';
23
+ }
24
+
25
let duration = (from.getTime() - to.getTime()) / 1000;
26
27
for (const division of RELATIVE_DIVISIONS) {
0 commit comments