Merge pull request #787 from mcastellaneta/mcastellaneta-raiplay.it-time

Change raiplay.it time to UTC
This commit is contained in:
Aleksandr Statciuk 2022-05-10 19:47:28 +03:00 committed by GitHub
commit 1604021e12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View file

@ -1,9 +1,11 @@
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(customParseFormat)
dayjs.extend(timezone)
module.exports = {
site: 'raiplay.it',
@ -17,8 +19,7 @@ module.exports = {
data.events.forEach(item => {
if (item.name && item.hour && item.duration_in_minutes) {
const startDate = dayjs
.utc(item.hour, 'HH:mm')
const startDate = dayjs.tz(item.hour, 'HH:mm','Europe/Rome')
.set('D', date.get('D'))
.set('M', date.get('M'))
.set('y', date.get('y'))
@ -46,8 +47,11 @@ module.exports = {
}
function parseIcon(item) {
return cover = item.image ? `https://www.raiplay.it${item.image}` : null
let cover = null;
if(item.image){
cover = `https://www.raiplay.it${item.image}`
}
return cover
}
function parseURL(item) {

View file

@ -27,8 +27,8 @@ it('can parse response', () => {
expect(result).toMatchObject([
{
start: '2022-05-03T19:40:00.000Z',
stop: '2022-05-03T20:30:00.000Z',
start: '2022-05-03T17:40:00.000Z',
stop: '2022-05-03T18:30:00.000Z',
title: 'The Good Doctor S3E5 - La prima volta',
description:
"Shaun affronta il suo primo intervento. Il caso si rivela complicato e, nonostante Shaun abbia un'idea geniale, sarà Andrews a portare a termine l'operazione.",