summaryrefslogtreecommitdiff
path: root/routes.js
diff options
context:
space:
mode:
authorRaphael Kabo <raphaelkabo@hey.com>2021-02-07 13:52:37 +0000
committerRaphael Kabo <raphaelkabo@hey.com>2021-02-07 13:52:37 +0000
commit4c25ce5460325e02ec6badbc5e19fd94625c89be (patch)
tree5bad7dac3ec55b979a401617104c0f25bc2d5e20 /routes.js
parentab5fda186b0deb7dafe790e68f7db3194d457f46 (diff)
Bugfix to ical generator
Diffstat (limited to 'routes.js')
-rwxr-xr-xroutes.js18
1 files changed, 11 insertions, 7 deletions
diff --git a/routes.js b/routes.js
index 808ec23..602b233 100755
--- a/routes.js
+++ b/routes.js
@@ -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);
}
})