EventMapper/modules/index.js

21 lines
No EOL
688 B
JavaScript

// Placeholder code from Anime Detour testing
import { ICAL } from '/assets/modules/ical_moz.js';
async function getWebDAV() {
const calrequest = await fetch("https://next.abtmtr.link/remote.php/dav/public-calendars/83tEFQ3myCro3WBL?export");
const calendar = await calrequest.text();
const jcal = ICAL.parse(calendar);
const comp = new ICAL.Component(jcal);
const events = comp.getAllSubcomponents("vevent").map(x => new ICAL.Event(x));
const elt = events.map(x => ({
summary: x.summary,
startDate: x.startDate.toJSDate(),
endDate: x.endDate.toJSDate(),
description: x.description,
location: x.location
}));
console.log(events, elt);
}
getWebDAV();