import { getLocale } from '@/paraglide/runtime'; const locale = getLocale() === 'vi' ? 'vi-VN' : 'en-US'; export const formatters = { dateTime: (v: string | Date) => { const parts = new Intl.DateTimeFormat(locale, { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit', hour12: true, }).formatToParts(new Date(v)); const map = Object.fromEntries(parts.map((p) => [p.type, p.value])); return `${map.day}/${map.month}/${map.year} ${map.hour}:${map.minute} ${map.hour12 ? 'AM' : 'PM'}`; }, };