added data table, formatter

revert context on __root beforeLoad
refactor project structure
refactor role badge
dynamic nav menu
This commit is contained in:
2026-01-14 09:35:46 +07:00
parent a44fa70500
commit edb4ebe11c
45 changed files with 1519 additions and 149 deletions

20
src/utils/formatters.ts Normal file
View File

@@ -0,0 +1,20 @@
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'}`;
},
};