Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: Don't use TZ offset for media Premiere Date #3210

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

fice-t
Copy link
Contributor

@fice-t fice-t commented Dec 9, 2023

I'm fairly new to Java/Kotlin/Android, so I'm not sure if this approach is the best, or if it should be used in other instances (such as in TimeUtils). It at least appears to fix the linked issue.

Is it reasonable to cut out usage of Date and stick with LocalDateTime, here and perhaps in TimeUtils?

Also: the "Premiere" date for TV seasons inside InfoLayoutHelper::addDate is in UTC, but the "Premiere"/"Born" date for actors is... odd. For example, in UTC-6: 1950-01-01T06:00, and UTC+3: 1950-01-01T15:00. Is this coming from the server, or was it changed in the client? Perhaps it acts oddly when the client is set to a different TZ than the server?

Changes

TimeUtils.getDate internally calls Date.format, which translates the UTC timestamp into local TZ timestamp. If a user is in a TZ with negative offset, then the Premiere Date will be presented as a day earlier.

Example with TZ of UTC-6:

item.getPremiereDate() => 2023-12-09T00:00
TimeUtils.getDate(item.getPremiereDate()) => Sat Dec 08 18:00:00 CST 2023

Issues

Fixes #3190.

TimeUtils.getDate internally calls Date.format, which translates the UTC
timestamp into local TZ timestamp. If a user is in a TZ with negative offset,
then the Premiere Date will be presented as a day earlier.

Example with TZ of UTC-6:

item.getPremiereDate()                    => 2023-12-09T00:00
TimeUtils.getDate(item.getPremiereDate()) => Sat Dec 08 18:00:00 CST 2023

Fixes jellyfin#3190.
Copy link
Member

@nielsvanvelzen nielsvanvelzen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old apiclient used Date, everything with the new SDK uses java.time. For conversion we have the ModelCompat helpers that will convert Date->java.time. I thought I fixed most of the timezone issues but apparently not 😄.

@nielsvanvelzen nielsvanvelzen added this to the v0.16.1 milestone Dec 12, 2023
@nielsvanvelzen nielsvanvelzen added the bug Something isn't working label Dec 12, 2023
@nielsvanvelzen nielsvanvelzen merged commit afddc96 into jellyfin:master Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firestick app shows wrong airdates
2 participants