Skip to content

fix: respect system 24-hour format for message timestamps - #460

Open
feather2222 wants to merge 1 commit into
gotify:masterfrom
feather2222:fix-24-hour-time-format
Open

feather2222 wants to merge 1 commit into
gotify:masterfrom
feather2222:fix-24-hour-time-format

Conversation

@feather2222

Copy link
Copy Markdown

Fixes #435

Problem

The in-app message list formats absolute timestamps with
java.text.DateFormat.getTimeInstance() / getDateTimeInstance(). These
formatters 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() and
getDateFormat() instead, which honor the user's system 12/24-hour
preference. 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

  • Verified with ./gradlew :app:assembleDebug :app:lintDebug (both pass)
  • With 24-hour format enabled in system settings, tapping a message's
    relative timestamp now shows the absolute time in 24-hour format

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
@jmattheis

jmattheis commented Oct 14, 2026 •

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Android 16 / One UI 7 shows 12-hour timestamps even when system is set to 24-hour

2 participants