diff options
author | Raphael Kabo <raphaelkabo@hey.com> | 2021-02-07 13:52:37 +0000 |
---|---|---|
committer | Raphael Kabo <raphaelkabo@hey.com> | 2021-02-07 13:52:37 +0000 |
commit | 4c25ce5460325e02ec6badbc5e19fd94625c89be (patch) | |
tree | 5bad7dac3ec55b979a401617104c0f25bc2d5e20 /routes.js | |
parent | ab5fda186b0deb7dafe790e68f7db3194d457f46 (diff) |
Bugfix to ical generator
Diffstat (limited to 'routes.js')
-rwxr-xr-x | routes.js | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -82,10 +82,7 @@ function render_plain() { const ical = require('ical'); const icalGenerator = require('ical-generator'); -const cal = icalGenerator({ - domain: domain, - name: siteName -}); + const sgMail = require('@sendgrid/mail'); const nodemailer = require("nodemailer"); @@ -616,8 +613,15 @@ router.get('/exportevent/:eventID', (req, res) => { }) .populate('eventGroup') .then((event) => { + console.log(event); if (event) { - const icalEvent = cal.createEvent({ + // Create a new icalGenerator... generator + const cal = icalGenerator({ + domain: domain, + name: siteName + }); + // Add the event to it + cal.createEvent({ start: moment.tz(event.start, event.timezone), end: moment.tz(event.start, event.timezone), timezone: event.timezone, @@ -631,9 +635,9 @@ router.get('/exportevent/:eventID', (req, res) => { location: event.location, url: 'https://gath.io/' + event.id }); - + // Stringify it! let string = cal.toString(); - console.log(string) + console.log(JSON.stringify(string)); res.send(string); } }) |