1
0
mirror of https://github.com/comatory/fb2iCal synced 2025-06-05 22:09:25 +02:00

fix: use browser's timezone to reflect correct time and date

This commit is contained in:
Ondřej Synáček
2021-01-02 20:17:21 +01:00
parent 3b7e69bd8e
commit 71ba9d8533
2 changed files with 11 additions and 3 deletions

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 || {}