Merge pull request #12 from comatory/fix-use-browser-timezone
Fix use browser timezone
This commit is contained in:
commit
b1e5abfcc7
|
@ -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
|
||||
|
|
|
@ -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 || {}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "facebook-events-ical-converter",
|
||||
"version": "1.4.4",
|
||||
"version": "2.0.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in New Issue