sort table rows by createdAt record property instead of IDs

This commit is contained in:
Ondřej Synáček 2019-11-24 21:36:15 +01:00
parent 389ad386d9
commit ddbf307c29
1 changed files with 4 additions and 2 deletions

View File

@ -174,10 +174,12 @@
storageContents
.sort((a, b) => {
if (a.id < b.id) {
const aDate = new Date(a.createdAt)
const bDate = new Date(b.createdAt)
if (aDate < bDate) {
return -1
}
if (a.id > b.id) {
if (aDate > bDate) {
return 1
}
return 0