fix: sorting events by date
This commit is contained in:
parent
37d931f6ce
commit
579bde6c32
|
@ -27,7 +27,7 @@ const createEventStore = () => {
|
|||
startTime: startTime.toString(),
|
||||
title,
|
||||
},
|
||||
]
|
||||
].sort(sortRecord)
|
||||
}
|
||||
|
||||
state = nextState
|
||||
|
|
|
@ -15,10 +15,10 @@ export const sortRecord = (a, b) => {
|
|||
const bDate = new Date(b.createdAt)
|
||||
|
||||
if (aDate < bDate) {
|
||||
return -1
|
||||
return 1
|
||||
}
|
||||
if (aDate > bDate) {
|
||||
return 1
|
||||
return -1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue