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:
25
lib/frontend/utils.js
Normal file
25
lib/frontend/utils.js
Normal 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
|
||||
}
|
||||
|
Reference in New Issue
Block a user