Commit 5c0691d8d6

5c0691d8d65d61f1183419f664df9775d8bcb3f4

parent: 3806d4755b

Unsigned

Alicia Sykes <alicia@omg.lol> · 2024-03-24 13:00 UTC

Adds a timestamp to date util

Layout: unified · split

web/src/utils/dates-n-stuff.ts +9
@@ -6,6 +6,15 @@ export const formatDate = (date: string): string => {
66 });
77}
88
9export const timestampToDate = (timestamp: number): string => {
10 return new Date(timestamp).toLocaleDateString('en-GB', {
11 day: '2-digit',
12 month: 'short',
13 year: '2-digit'
14 });
15
16}
17
918export const timeAgo = (dateStr: string): string => {
1019 const seconds = Math.floor((new Date().getTime() - new Date(dateStr).getTime()) / 1000);
1120 const intervals = {