Update hd-plus.de.config.js

Fixes wrong timeshift
This commit is contained in:
freearhey 2021-05-03 15:05:50 +03:00
parent c9cebf2371
commit c94b4e0fdb

View file

@ -3,9 +3,11 @@ const { JSDOM } = jsdom
const dayjs = require('dayjs') const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc') const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat') const customParseFormat = require('dayjs/plugin/customParseFormat')
const timezone = require('dayjs/plugin/timezone')
dayjs.extend(utc) dayjs.extend(utc)
dayjs.extend(customParseFormat) dayjs.extend(customParseFormat)
dayjs.extend(timezone)
module.exports = { module.exports = {
lang: 'de', lang: 'de',
@ -33,7 +35,8 @@ module.exports = {
const fullDate = (item.querySelector('td:nth-child(2)') || { textContent: '' }).textContent const fullDate = (item.querySelector('td:nth-child(2)') || { textContent: '' }).textContent
if (title && fullDate) { if (title && fullDate) {
const time = fullDate.split(' ').pop() const time = fullDate.split(' ').pop()
const start = dayjs.utc(time, 'HH:mm') const local = dayjs.utc(time, 'HH:mm').toString()
const start = dayjs.tz(local.toString(), 'Europe/Berlin').toString()
if (programs.length && !programs[programs.length - 1].stop) { if (programs.length && !programs[programs.length - 1].stop) {
programs[programs.length - 1].stop = start programs[programs.length - 1].stop = start
@ -41,7 +44,7 @@ module.exports = {
programs.push({ programs.push({
title, title,
start: start.toString() start
}) })
} }
}) })