Files
dticket.tootaio.com/app/utils/formatters.ts
xiaomai 1318e766d5 feat(i18n): add multi-language support (en/zh) across app and server
Implement useLocale composable and shared translation dictionaries
Translate public pages, booking flow, and receipt views
Store booking locale to send localized WhatsApp notifications
2026-05-08 15:31:44 +08:00

13 lines
350 B
TypeScript

import type { AppLocale } from '~~/shared/i18n'
export function formatDateTime(value: string | null, fallback = 'Not available', locale: AppLocale = 'en') {
if (!value) {
return fallback
}
return new Intl.DateTimeFormat(locale === 'zh' ? 'zh-MY' : 'en-MY', {
dateStyle: 'medium',
timeStyle: 'short'
}).format(new Date(value))
}