Update movistarplus.es.config.js

This commit is contained in:
Aleksandr Statciuk 2023-06-07 02:54:01 +03:00
parent ddfae7b3d3
commit b2b3a49509

View file

@ -1,10 +1,4 @@
const dayjs = require('dayjs')
const timezone = require('dayjs/plugin/timezone')
const utc = require('dayjs/plugin/utc')
var customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(customParseFormat)
const { DateTime } = require('luxon')
module.exports = {
site: 'movistarplus.es',
@ -18,25 +12,25 @@ module.exports = {
if (!items.length) return programs
let guideDate = date
items.forEach(item => {
let startTime = dayjs.tz(
let startTime = DateTime.fromFormat(
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_INICIO}`,
'YYYY-MM-DD HH:mm',
'Europe/Madrid'
)
let stopTime = dayjs.tz(
'yyyy-MM-dd HH:mm',
{ zone: 'Europe/Madrid' }
).toUTC()
let stopTime = DateTime.fromFormat(
`${guideDate.format('YYYY-MM-DD')} ${item.HORA_FIN}`,
'YYYY-MM-DD HH:mm',
'Europe/Madrid'
)
if (stopTime.isBefore(startTime)) {
'yyyy-MM-dd HH:mm',
{ zone: 'Europe/Madrid' }
).toUTC()
if (stopTime < startTime) {
guideDate = guideDate.add(1, 'd')
stopTime = stopTime.add(1, 'd')
stopTime = stopTime.plus({ days: 1 })
}
programs.push({
title: item.TITULO,
category: item.GENERO,
start: startTime.toJSON(),
stop: stopTime.toJSON()
start: startTime,
stop: stopTime
})
})
return programs