generated from sportstimes/gatsby-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen-cal.js
42 lines (36 loc) · 1.18 KB
/
gen-cal.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const { writeFileSync } = require('fs')
const ics = require('ics')
let moment = require("moment")
let start = moment('2019-07-10T18:00Z').format('YYYY-M-D-H-m').split("-")
let events = [
{
start: start,
duration: { hours: 0, minutes: 30 },
title: 'First ICS event',
description: 'Getting ICS node package integrated with this repo',
location: 'Virgin Train, West Coast Mainline',
url: 'https://kickofftimestemplate.netlify.com/',
categories: ['Code', 'Side Projects', 'Kick Off'],
status: 'CONFIRMED',
organizer: { name: 'Si Jobling', email: '[email protected]' },
},
{
start: [2019, 8, 20, 8, 20],
duration: { hours: 0, minutes: 30 },
title: 'Second ICS event',
description: 'Creating a second event',
location: 'London Euston Train Station',
url: 'https://kickofftimestemplate.netlify.com/',
categories: ['Code', 'Side Projects', 'Kick Off'],
status: 'CONFIRMED',
organizer: { name: 'Si Jobling', email: '[email protected]' },
},
]
ics.createEvents(events, (error, value) => {
if (error) {
console.log(error)
return
}
console.log(value)
writeFileSync(`${__dirname}/event.ics`, value)
})