restore range event on calendar

This commit is contained in:
lesion
2022-09-05 15:28:00 +02:00
parent 81c2bd3dd1
commit bc89a04e1d

View File

@@ -8,12 +8,26 @@ export function attributesFromEvents (_events) {
const now = dayjs().unix()
for (let e of _events) {
const key = dayjs.unix(e.start_datetime).tz().format('YYYYMMDD')
const c = e.start_datetime < now ? 'vc-past' : ''
const c = (e.end_datetime || e.start_datetime) < now ? 'vc-past' : ''
if (e.multidate) {
attributes.push({
dates: { start: new Date(e.start_datetime * 1000), end: new Date(e.end_datetime * 1000) },
highlight: {
start: { fillMode: 'outline' },
base: { fillMode: 'light' },
end: { fillMode: 'outline' },
}
})
continue
}
const i = attributes.find(a => a.day === key)
if (!i) {
attributes.push({ day: key, key: e.id, n: 1, dates: new Date(e.start_datetime * 1000),
dot: { color: 'teal', class: c } })
attributes.push({
day: key, key: e.id, n: 1, dates: new Date(e.start_datetime * 1000),
dot: { color: 'teal', class: c }
})
continue
}