Process dates

This commit is contained in:
2021-04-21 17:49:47 +02:00
parent dac00ccf3a
commit 5fec0aa24c
3 changed files with 70 additions and 15 deletions

View File

@ -24,19 +24,6 @@ class GroupPresencePage {
target.appendChild(el);
Vue.createApp({
data: () => {
return {
}
},
methods: {
}
}).mount(el);
const calEvents = presence.map((e) => {
return {
@ -44,7 +31,7 @@ class GroupPresencePage {
start: new Date(e.year, e.month - 1, e.day),
backgroundColor: "#0073b7", //Blue
borderColor: "#0073b7", //Blue
editable: false,
editable: e.userID == userID(),
allDay: true,
description: users.get(e.userID).fullName
}
@ -59,6 +46,22 @@ class GroupPresencePage {
},
initialView: 'dayGridMonth',
events: calEvents,
// Update events
eventResize: function(info) {
const newDays = new Set(getDaysOfRange(info.event.start, info.event.end).map(el => el.getTime()));
const oldDays = new Set(getDaysOfRange(info.oldEvent.start, info.oldEvent.end).map(el => el.getTime()));
for (const el of newDays) {
if(oldDays.has(el)) {
newDays.delete(el)
oldDays.delete(el)
}
}
console.info("add", newDays)
console.info("del", oldDays)
}
});
calendar.render()