mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Update tv.mail.ru.config.js
This commit is contained in:
parent
02cdbbd05e
commit
8083b4881d
1 changed files with 5 additions and 12 deletions
|
@ -1,11 +1,4 @@
|
|||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const timezone = require('dayjs/plugin/timezone')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
dayjs.extend(customParseFormat)
|
||||
const { DateTime } = require('luxon')
|
||||
|
||||
module.exports = {
|
||||
site: 'tv.mail.ru',
|
||||
|
@ -22,13 +15,13 @@ module.exports = {
|
|||
const prev = programs[programs.length - 1]
|
||||
let start = parseStart(item, date)
|
||||
if (prev) {
|
||||
if (start.isBefore(prev.start)) {
|
||||
start = start.add(1, 'd')
|
||||
if (start < prev.start) {
|
||||
start = start.plus({ days: 1 })
|
||||
date = date.add(1, 'd')
|
||||
}
|
||||
prev.stop = start
|
||||
}
|
||||
const stop = start.add(1, 'h')
|
||||
const stop = start.plus({ hours: 1 })
|
||||
programs.push({
|
||||
title: item.name,
|
||||
category: parseCategory(item),
|
||||
|
@ -44,7 +37,7 @@ module.exports = {
|
|||
function parseStart(item, date) {
|
||||
const dateString = `${date.format('YYYY-MM-DD')} ${item.start}`
|
||||
|
||||
return dayjs.tz(dateString, 'YYYY-MM-DD HH:mm', 'Europe/Moscow')
|
||||
return DateTime.fromFormat(dateString, 'yyyy-MM-dd HH:mm', { zone: 'Europe/Moscow' }).toUTC()
|
||||
}
|
||||
|
||||
function parseCategory(item) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue