diff --git a/package.json b/package.json index 02305f71..23ef3f09 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "readme:update": "node scripts/commands/readme/update.js", "test": "npx jest --runInBand", "test:commands": "npx jest --runInBand -- commands", - "test:sites": "npx jest --runInBand -- sites", + "test:sites": "TZ=UTC npx jest --runInBand -- sites", "act:test": "act workflow_dispatch -W .github/workflows/_test.yml", "act:check": "act workflow_dispatch -W .github/workflows/_check.yml", "act:update-readme": "act workflow_dispatch -W .github/workflows/_update-readme.yml", diff --git a/sites/artonline.tv/artonline.tv.config.js b/sites/artonline.tv/artonline.tv.config.js index 4aadf797..f5980dc8 100644 --- a/sites/artonline.tv/artonline.tv.config.js +++ b/sites/artonline.tv/artonline.tv.config.js @@ -17,7 +17,7 @@ module.exports = { headers: { 'content-type': 'application/x-www-form-urlencoded' }, - data: function({ date }) { + data: function ({ date }) { const diff = date.diff(dayjs.utc().startOf('d'), 'd') const params = new URLSearchParams() params.append('objId', diff) @@ -27,7 +27,7 @@ module.exports = { }, parser: function ({ content }) { const programs = [] - if(!content) return programs + if (!content) return programs const items = JSON.parse(content) items.forEach(item => { const icon = parseIcon(item) @@ -51,12 +51,12 @@ function parseStart(item) { const [_, M, D, YYYY] = item.adddate.match(/(\d+)\/(\d+)\/(\d+) /) const [HH, mm] = item.start_Time.split(':') - return dayjs(`${YYYY}-${M}-${D}T${HH}:${mm}:00`, 'YYYY-M-DTHH:mm:ss', 'Asia/Riyadh') + return dayjs.tz(`${YYYY}-${M}-${D}T${HH}:${mm}:00`, 'YYYY-M-DTHH:mm:ss', 'Asia/Riyadh') } function parseDuration(item) { const [__, HH, mm, ss] = item.duration.match(/(\d+):(\d+):(\d+)/) - + return parseInt(HH) * 3600 + parseInt(mm) * 60 + parseInt(ss) } diff --git a/sites/gatotv.com/gatotv.com.test.js b/sites/gatotv.com/gatotv.com.test.js index 3bb20faa..310ddead 100644 --- a/sites/gatotv.com/gatotv.com.test.js +++ b/sites/gatotv.com/gatotv.com.test.js @@ -29,34 +29,34 @@ it('can parse response', () => { expect(result).toMatchObject([ { - start: '2021-11-12T20:00:00.000Z', - stop: '2021-11-12T21:30:00.000Z', + start: '2021-11-12T23:00:00.000Z', + stop: '2021-11-13T00:30:00.000Z', title: 'Bienvenidos a bordo' }, { - start: '2021-11-12T21:30:00.000Z', - stop: '2021-11-12T22:45:00.000Z', + start: '2021-11-13T00:30:00.000Z', + stop: '2021-11-13T01:45:00.000Z', title: 'Ciudad de sombras' }, { - start: '2021-11-12T22:45:00.000Z', - stop: '2021-11-13T00:30:00.000Z', + start: '2021-11-13T01:45:00.000Z', + stop: '2021-11-13T03:30:00.000Z', title: 'Rascacielos: Rescate en las Alturas', icon: 'https://imagenes.gatotv.com/categorias/peliculas/miniatura/rascacielos.jpg', description: 'Cuando un ex rescatista de rehenes del FBI evalúa la seguridad de un rascacielos en China, un incendio repentino hace que sea acusado injustamente.' }, { - start: '2021-11-13T10:30:00.000Z', - stop: '2021-11-13T10:41:00.000Z', + start: '2021-11-13T13:30:00.000Z', + stop: '2021-11-13T13:41:00.000Z', title: 'Los Jóvenes Titanes En Acción', icon: 'https://imagenes.gatotv.com/categorias/caricaturas/miniatura/los_jovenes_titanes_en_accion.jpg', description: 'Robin, Starfire, Raven, Chico Bestia y Cyborg se preparan para nuevas aventuras cómicas después de hacer un sándwich, jugar algún videojuego o lavar la ropa.' }, { - start: '2021-11-13T20:55:00.000Z', - stop: '2021-11-14T01:00:00.000Z', + start: '2021-11-13T23:55:00.000Z', + stop: '2021-11-14T04:00:00.000Z', title: 'Decisión 2021' } ])