Repository navigation
fix: respect system 24-hour format for message timestamps - #460
Open
feather2222 wants to merge 1 commit into
Open
feather2222 wants to merge 1 commit into
feather2222 wants to merge 1 commit into
Conversation
java.text.DateFormat.getTimeInstance() formats time according to the locale default and ignores the system's 24-hour format setting, so timestamps were shown in 12-hour format on devices with 24-hour format enabled (reported on Samsung One UI 7 / Android 16). Use android.text.format.DateFormat.getTimeFormat()/getDateFormat() instead, which honor the user's system preference. Fixes gotify#435
Member
|
I don't have a Samsung phone, so please show a screen recording with the master version similar to #435 (comment) where the 24/12h format setting is enabled/disabled and then showing how the date-format looks in gotify. And then do the same with the version from this branch. |
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.
Fixes #435
Problem
The in-app message list formats absolute timestamps with
java.text.DateFormat.getTimeInstance()/getDateTimeInstance(). Theseformatters only follow the locale default (e.g. 12-hour for en_US) and
ignore the system's "Use 24-hour format" setting, so timestamps are shown
in 12-hour format even when the user enabled 24-hour format (reported on
Samsung devices running Android 16 / One UI 7).
Change
Use
android.text.format.DateFormat.getTimeFormat()andgetDateFormat()instead, which honor the user's system 12/24-hourpreference. This applies to both branches of the absolute time format:
"today" (time only) and older messages (date + time).
Note: the timestamps shown in the system notification shade are rendered
by SystemUI and cannot be controlled by the app; this fix covers the
in-app message list timestamps.
Testing
./gradlew :app:assembleDebug :app:lintDebug(both pass)relative timestamp now shows the absolute time in 24-hour format