(timestamp: number)
| 14 | } |
| 15 | |
| 16 | export const formatDate = (timestamp: number) => { |
| 17 | const date = new Date(timestamp) |
| 18 | const locale = i18next.language || "en" |
| 19 | |
| 20 | return date.toLocaleString(locale, { |
| 21 | month: "long", |
| 22 | day: "numeric", |
| 23 | hour: "numeric", |
| 24 | minute: "2-digit", |
| 25 | hour12: true, |
| 26 | }) |
| 27 | } |
| 28 | |
| 29 | export const formatTimeAgo = (timestamp: number) => { |
| 30 | const now = Date.now() |