Repository navigation
Fix HBO primetime release time to use ET-local conversion - #3
Merged
Merged
Conversation
US_PRIMETIME was a literal UTC time ("02:00:00Z") stamped on the TMDb
air_date. Because TMDb's air_date is the local US broadcast date and HBO
airs in late-evening ET, the resulting moment landed on the previous
UTC day in ET (e.g. Euphoria S03E06 with air_date 2026-05-17 became
Sat May 16, 10pm ET instead of Sun May 17, 9pm ET).
Treat US_PRIMETIME as 21:00 America/New_York and reuse the DST-aware
local-to-UTC conversion already used by the PT/ET midnight strategies.
Drop Euphoria's redundant releaseTime override so it picks up the
corrected HBO strategy.
There was a problem hiding this comment.
Pull request overview
Fixes HBO primetime release time conversion which was previously stamping a literal UTC string and resulting in events being ~23 hours too early. The fix generalizes the existing DST-aware local→UTC helper to handle arbitrary local times (not just midnight) and restructures strategies as a discriminated union of { localTime, timezone } or { utc }.
Changes:
- Generalized
localMidnightToUtctolocalTimeToUtc, accepting a local time component with DST-aware offset resolution. - Restructured
strategiesinto a tagged union and routed all resolution through a singleresolveStrategyDateTimehelper;US_PRIMETIMEnow means 21:00 America/New_York. - Removed redundant
releaseTimeoverride on Euphoria, updated README, and added EDT/EST regression tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/release.ts | Generalize local-time conversion, refactor strategies to tagged union, simplify resolveDateTime. |
| src/shows.ts | Drop Euphoria's now-redundant releaseTime override. |
| tests/release.test.ts | Add HBO primetime regression tests for both EDT and EST air dates. |
| README.md | Document new local-time, DST-aware strategy format. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
While double-checking Euphoria's published times, I noticed the calendar event for S03E06 ("Stand Still and See") was landing about 23 hours too early.
What went wrong
US_PRIMETIMEwas a literal UTC string ("02:00:00Z") stamped on the TMDbair_date. TMDb'sair_dateis the local US broadcast date, but HBO airs in late-evening ET — so the resulting UTC moment fell on the previous day in ET:air_datestartsAt2026-05-17T02:00:00Z2026-05-18T01:00:00Z)The PT/ET midnight strategies already do DST-aware local→UTC conversion via
localMidnightToUtc.US_PRIMETIMEdid not.Fix
US_PRIMETIMEas21:00 America/New_Yorkand reuse the DST-aware local-to-UTC conversion (generalizedlocalMidnightToUtc→localTimeToUtc).strategiesso each entry is either{ localTime, timezone }or{ utc }.releaseTime: "02:00:00Z"override so it picks up the corrected HBO strategy.Test plan
pnpm test— 30 passed (added two HBO regression tests covering EDT and EST air dates)pnpm run typecheckpnpm run build/api/cal/euphoria.icsand confirm S03E06 now shows Mon May 18 02:00 BST (i.e., Sun May 17 9pm EDT) in the calendar client