8000 Single-episode air date is UTC, like the episode list (jikan-rest#567) by irfan-dahir · Pull Request #664 · jikan-me/jikan · GitHub
[go: up one dir, main page]

Skip to content

Single-episode air date is UTC, like the episode list (jikan-rest#567) - #664

Merged
irfan-dahir merged 3 commits into
masterfrom
v5/episode-aired-utc
Oct 15, 2026
Merged

irfan-dahir merged 3 commits into
masterfrom
v5/episode-aired-utc

Conversation

@irfan-dahir
Copy link
Copy Markdown
Collaborator

Needs jikan-me/jikan-fixtures#17 merged first (two snapshot lines); CI fails until then because it clones fixtures master.

Fixes jikan-rest#567: /anime/{id}/episodes and /anime/{id}/episodes/{n} returned different aired values for the same episode (...T00:00:00+00:00 against ...T00:00:00+09:00).

Cause

The single-episode page prints Aired: Oct 20, 1999(JST). AnimeEpisodeParser::getAired() passed that text, marker included, to Parser::parseDate(), and PHP read "(JST)" as a UTC+9 offset. The episode list prints no marker, and Anime::getAired() and about 25 other date sites give UTC midnight.

Change

  • The marker is stripped, so getAired() is UTC midnight of the printed day, the same as everywhere else. The calendar date is unchanged; the instant is 9 hours later. It's under Changed in the changelog, because anyone comparing timestamps will see the difference.
  • ModelInvariants gains a non-utc-date rule. Across every recorded page it flags exactly this one date. Without the fix it fails; with the fix nothing needs an allowlist.
  • EpisodeAiredTest: the list and the single page agree for the same episode, and the day printed with or without "(JST)", with a space, or month-only gives UTC midnight. It fails without the fix.
  • The old it_gets_aired_date test pinned the JST timestamp; it now states the expected date as text.

Not changed: card dates

Anime-card start dates (seasonal, schedule, genre, producer lists) are also converted from JST midnight to UTC, so "Oct 2, 2026" comes out as 2026-10-01T15:00:00+00:00: a day earlier than Anime::getAired(). This predates #656. It deserves its own decision, so it's not in this PR.

🤖 Generated with Claude Code

The single-episode page prints "Aired: Oct 20, 1999(JST)"; PHP read the marker as
UTC+9, so getAnimeEpisode() gave 1999-10-20T00:00:00+09:00 while the episode list
and Anime::getAired() give 1999-10-20T00:00:00+00:00. The marker is stripped.

ModelInvariants gains a non-utc-date rule so no model date can carry another
offset unnoticed; before this fix it flagged this one date and nothing else
across every recorded page. EpisodeAiredTest compares the two endpoints.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Cards were converted from midnight in Japan to UTC, so "Oct 2, 2026" read as
2026-10-01T15:00Z and a year-only "2027" as 2026-12-31T15:00Z (the previous year),
while Anime::getAired(), the episodes and DateRange are UTC midnight. The hidden
start date and the shown text now both give UTC midnight; text with a broadcast
time still converts from Japan time (a real instant).

Checked on every recorded card page: 2,049 snapshot dates move by exactly +9 hours
and nothing else changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Anime-card start dates are UTC midnight of the day shown
@irfan-dahir
irfan-dahir merged commit 80c4af1 into master Oct 15, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 getAnimeEpisodes and getAnimeEpisodeById endpoints return different dates in aired field

1 participant

0