Merge pull request #12 from comatory/fix-use-browser-timezone

Fix use browser timezone
This commit is contained in:
Ondrej Synacek 2021-01-02 20:22:37 +01:00 committed by GitHub
commit b1e5abfcc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 5 deletions

View File

@ -2,7 +2,11 @@ const ics = require('ics')
const generateICS = async(data) => {
return new Promise((resolve, reject) => {
ics.createEvent(data, (err, value) => {
ics.createEvent({
...data,
startInputType: 'utc',
endInputType: 'utc',
}, (err, value) => {
if (err) {
reject(err)
return

View File

@ -1,12 +1,16 @@
const cheerio = require('cheerio')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const { parseDates } = require('../parser-utils')
dayjs.extend(utc)
const parseEventData = (eventData) => {
const startDate = eventData.startDate ?
dayjs(eventData.startDate) :
dayjs(new Date())
const endDate = eventData.endDate && dayjs(eventData.endDate)
dayjs.utc(new Date())
const endDate = eventData.endDate && dayjs.utc(eventData.endDate)
const { start, duration } = parseDates(startDate, endDate)
const { location } = eventData || {}
const { address } = location || {}

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "facebook-events-ical-converter",
"version": "1.4.4",
"version": "2.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "facebook-events-ical-converter",
"version": "1.4.4",
"version": "2.0.0",
"private": true,
"description": "App that converts events on Facebook event page to iCal file.",
"main": "lib/index.js",