fix(api): normalise the Next Up cutoff to UTC #30

Merged
benvin merged 1 commits from benvin/nextup-datetime-kind into main 2026-09-21 07:42:33 +10:00
Member

GET /Shows/NextUp returns 500 on the PostgreSQL backend. The model binder hands nextUpDateCutoff over as DateTimeKind.Unspecified, and Npgsql refuses to write anything but UTC to timestamp with time zone, so the Next Up series lookup throws on enumeration. SQLite normalises kinds in its provider and hides this.

  • convert the supplied cutoff to UTC in TvShowsController.GetNextUp
  • default NextUpQuery.NextUpDateCutoff to a UTC DateTime.MinValue
  • add a PostgreSQL regression test driving the cutoff from the controller into the series lookup

Closes #26

GET /Shows/NextUp returns 500 on the PostgreSQL backend. The model binder hands `nextUpDateCutoff` over as `DateTimeKind.Unspecified`, and Npgsql refuses to write anything but UTC to `timestamp with time zone`, so the Next Up series lookup throws on enumeration. SQLite normalises kinds in its provider and hides this. - convert the supplied cutoff to UTC in `TvShowsController.GetNextUp` - default `NextUpQuery.NextUpDateCutoff` to a UTC `DateTime.MinValue` - add a PostgreSQL regression test driving the cutoff from the controller into the series lookup Closes #26
unkin-agent added 1 commit 2026-09-20 23:47:32 +10:00
fix(api): normalise the Next Up cutoff to UTC
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/push/ci Pipeline was successful
face8ac653
The query-string cutoff binds as DateTimeKind.Unspecified, which Npgsql
refuses to write to timestamp with time zone, so /Shows/NextUp 500s.
Author
Member

nit: MediaBrowser.Model/Querying/NextUpQuery.cs:15 / Jellyfin.Api/Controllers/TvShowsController.cs:111 — the DateTime.MinValue Kind-normalisation is a no-op, not part of the fix: verified against Npgsql 10.0.3 + PG16 that DateTime.MinValue writes to timestamp with time zone fine regardless of Kind (Unspecified/Local/Utc all succeed); only a non-MinValue cutoff with a non-Utc Kind throws → correct the PR description, this bullet does not address the 500.
nit: tests/Jellyfin.Server.Tests/Item/PostgreSqlNextUpServiceTests.cs:35-36,91 — comment states the model binder "hands a query-string date over as Unspecified"; verified that only holds for a tz-less string, a Z/offset-suffixed cutoff binds as DateTimeKind.Local instead → reword to cover both cases.

nit: `MediaBrowser.Model/Querying/NextUpQuery.cs:15` / `Jellyfin.Api/Controllers/TvShowsController.cs:111` — the `DateTime.MinValue` Kind-normalisation is a no-op, not part of the fix: verified against Npgsql 10.0.3 + PG16 that `DateTime.MinValue` writes to `timestamp with time zone` fine regardless of Kind (Unspecified/Local/Utc all succeed); only a non-MinValue cutoff with a non-Utc Kind throws → correct the PR description, this bullet does not address the 500. nit: `tests/Jellyfin.Server.Tests/Item/PostgreSqlNextUpServiceTests.cs:35-36,91` — comment states the model binder "hands a query-string date over as Unspecified"; verified that only holds for a tz-less string, a `Z`/offset-suffixed cutoff binds as `DateTimeKind.Local` instead → reword to cover both cases.
benvin merged commit 393994a454 into main 2026-09-21 07:42:33 +10:00
Sign in to join this conversation.