(ts: number, t?: (key: string, vars?: Record<string, string | number>) => string)
| 7 | import { useI18n } from "@/i18n"; |
| 8 | |
| 9 | function formatTime(ts: number, t?: (key: string, vars?: Record<string, string | number>) => string) { |
| 10 | const diff = Date.now() - ts; |
| 11 | const mins = Math.floor(diff / 60000); |
| 12 | if (mins < 1) return t ? t("common.justNow") : "just now"; |
| 13 | if (mins < 60) return t ? t("trade.minAgo", { m: mins }) : `${mins}m ago`; |
| 14 | const hours = Math.floor(mins / 60); |
| 15 | if (hours < 24) return t ? t("trade.hAgo", { h: hours }) : `${hours}h ago`; |
| 16 | return `${Math.floor(hours / 24)}d`; |
| 17 | } |
| 18 | |
| 19 | const CATEGORIES: Category[] = [ |
| 20 | "Politics", "Crypto", "Sports", |
no outgoing calls
no test coverage detected