From 163634dee31bb94cf5cd0dcf914eb8cb21d7ddea Mon Sep 17 00:00:00 2001 From: dblake10 <162507726+dblake10@users.noreply.github.com> Date: Tue, 24 Feb 2026 16:09:43 -0600 Subject: [PATCH] Fix tvpassport.com timezone to be dynamic from the content Uses the timezone from the selected timezone of the dropdown on the page, instead of always hardcoding America/New_York. This fixes an offset I was having from pulling the guide from an IP address in the central timezone. --- sites/tvpassport.com/tvpassport.com.config.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sites/tvpassport.com/tvpassport.com.config.js b/sites/tvpassport.com/tvpassport.com.config.js index b7f98d83..8c462029 100644 --- a/sites/tvpassport.com/tvpassport.com.config.js +++ b/sites/tvpassport.com/tvpassport.com.config.js @@ -29,10 +29,11 @@ module.exports = { }, parser: function ({ content }) { let programs = [] + const currentTimezone = parseCurrentTimezone(content) const items = parseItems(content) for (let item of items) { const $item = cheerio.load(item) - const start = parseStart($item) + const start = parseStart($item, currentTimezone) const duration = parseDuration($item) const stop = start.add(duration, 'm') let title = parseTitle($item) @@ -174,10 +175,10 @@ function parseRating($item) { : null } -function parseStart($item) { +function parseStart($item, currentTimezone) { const time = $item('*').data('st') - return dayjs.tz(time, 'YYYY-MM-DD HH:mm:ss', 'America/New_York') + return dayjs.tz(time, 'YYYY-MM-DD HH:mm:ss', currentTimezone) } function parseDuration($item) { @@ -192,3 +193,10 @@ function parseItems(content) { return $('.station-listings .list-group-item').toArray() } + +function parseCurrentTimezone(content) { + if (!content) return 'America/New_York' + const $ = cheerio.load(content) + + return $('#timezone_selector').val() +}