const ical = require('ical-generator');
const cal = ical({domain: 'localhost'});
const data = {
"address": "",
"attendeesCount": 0,
"authorId": "Rikke",
"canComment": true,
"commentsCount": 0,
"content": "Test",
"endDateTime": 1593727200,
"eventType": "Activity",
"geonameId": "2622170",
"id": "PRL3iujYMiE57LglNwgj",
"media": [
"https://firebasestorage.googleapis.com/v0/b/minlan…=media&token=ff111bb0-fa75-4412-9cb1-c16e1aab6449",
"https://firebasestorage.googleapis.com/v0/b/minlan…=media&token=e2cb61d6-5485-4267-b895-212bcc26e1a2",
"https://firebasestorage.googleapis.com/v0/b/minlan…=media&token=a6c32ec2-3041-4674-874e-545b30ad730b"
],
"postalCode": "",
"startDateTime": 1593684000,
"tags": [],
"title": "Test",
"unionId": null,
"viewsCount": 0,
"villgInfo": {
"geonameId": "2622170",
"toponymName": "Fjaltring"
}
}
var media = data['media'][0];
cal.domain('example.com');
const event = cal.createEvent({
start: new Date(),
end: new Date(),
summary: 'Example Event',
description: 'It works ;)',
organizer: 'Organizer\'s Name <organizer@example.com>',
url: 'https://example.com',
x: { "X-IMAGE;FMTTYPE": `${media}` }
});
// update event's description
event.description('It still works ;)');
cal.toString();