feat: refactor news and category schemas, update API response handling, and improve date formatting

This commit is contained in:
Ardeman
2025-03-07 08:50:04 +08:00
parent 661437a2d3
commit 1bb63bec8e
7 changed files with 92 additions and 192 deletions
+5 -5
View File
@@ -3,9 +3,9 @@ export const formatNumberWithPeriods = (number: number) => {
}
export const formatDate = (isoDate: string): string => {
const date = new Date(isoDate)
const day = date.getDate().toString().padStart(2, '0')
const month = (date.getMonth() + 1).toString().padStart(2, '0') // Month is zero-based
const year = date.getFullYear()
return `${day}/${month}/${year}`
return new Intl.DateTimeFormat('id-ID', {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}).format(date)
}