1
0
mirror of https://github.com/comatory/fb2iCal synced 2025-06-05 22:09:25 +02:00

feature: use Svelte to render event list

This commit is contained in:
Ondřej Synáček
2020-12-15 22:42:56 +01:00
parent 470184aec0
commit 978662b55c
4 changed files with 119 additions and 2 deletions

25
lib/frontend/utils.js Normal file
View File

@ -0,0 +1,25 @@
export const migrateRecord = (record) => {
// NOTE: v3 records
const id = record.id || record.order
const startTime = record.startTime || null
return {
...record,
id,
startTime,
}
}
export const sortRecord = (a, b) => {
const aDate = new Date(a.createdAt)
const bDate = new Date(b.createdAt)
if (aDate < bDate) {
return -1
}
if (aDate > bDate) {
return 1
}
return 0
}