util: Don't use TZ offset for media Premiere Date #3210
Merged
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.
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 withLocalDateTime
, here and perhaps inTimeUtils
?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 callsDate.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.