amalia/18-mei-26 #49

Merged
amaliadwiy merged 5 commits from amalia/18-mei-26 into join 2026-05-18 17:28:19 +08:00
5 changed files with 80 additions and 30 deletions
Showing only changes of commit 3f113a4049 - Show all commits

View File

@@ -78,6 +78,15 @@ export default function Notification() {
}, [data])
const listData = useMemo<ListRow[]>(() => {
const BULAN: Record<string, number> = {
'JAN': 0, 'FEB': 1, 'MAR': 2, 'APR': 3, 'MEI': 4, 'JUN': 5,
'JUL': 6, 'AGU': 7, 'SEP': 8, 'OKT': 9, 'NOV': 10, 'DES': 11,
}
const parseDate = (str: string) => {
const [d, m, y] = str.split(' ')
return new Date(Number(y), BULAN[m] ?? 0, Number(d)).getTime()
}
const groups: Record<string, Props[]> = {}
const dateOrder: string[] = []
@@ -89,6 +98,8 @@ export default function Notification() {
groups[item.createdAt].push(item)
})
dateOrder.sort((a, b) => parseDate(b) - parseDate(a))
const result: ListRow[] = []
dateOrder.forEach((date) => {
result.push({ _type: 'header', date })