Update m.tv.sms.cz.config.js

Fixes wrong date of next day programs
This commit is contained in:
freearhey
2021-05-03 14:47:02 +03:00
parent f1b90a8cff
commit a80fd17c15

View File

@@ -29,7 +29,7 @@ module.exports = {
const programs = [] const programs = []
const dom = new JSDOM(content) const dom = new JSDOM(content)
const items = dom.window.document.querySelectorAll('#obsah > div > div.porady > div.porad') const items = dom.window.document.querySelectorAll('#obsah > div > div.porady > div.porad')
items.forEach(item => { items.forEach((item, i) => {
const time = (item.querySelector('div > span') || { textContent: '' }).textContent const time = (item.querySelector('div > span') || { textContent: '' }).textContent
.toString() .toString()
.trim() .trim()
@@ -41,11 +41,11 @@ module.exports = {
.trim() .trim()
if (time && title) { if (time && title) {
const local = dayjs let local = dayjs.utc(time, 'HH.mm').date(date.date()).month(date.month()).year(date.year())
.utc(time, 'HH.mm')
.date(date.date()) if (local.hour() <= 6 && i > items.length / 2) {
.month(date.month()) local = local.date(local.date() + 1)
.year(date.year()) }
const start = dayjs.tz(local.toString(), 'Europe/Prague').toString() const start = dayjs.tz(local.toString(), 'Europe/Prague').toString()
if (programs.length && !programs[programs.length - 1].stop) { if (programs.length && !programs[programs.length - 1].stop) {