Commit 5c0691d8d6
Unsigned
Layout: unified · split
web/src/utils/dates-n-stuff.ts +9
| @@ -6,6 +6,15 @@ export const formatDate = (date: string): string => { | |||
| 6 | }); | 6 | }); |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | export 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 | |||
| 9 | export const timeAgo = (dateStr: string): string => { | 18 | export const timeAgo = (dateStr: string): string => { |
| 10 | const seconds = Math.floor((new Date().getTime() - new Date(dateStr).getTime()) / 1000); | 19 | const seconds = Math.floor((new Date().getTime() - new Date(dateStr).getTime()) / 1000); |
| 11 | const intervals = { | 20 | const intervals = { |