signalapp / Signal-Desktop

A private messenger for Windows, macOS, and Linux.
https://signal.org/download
GNU Affero General Public License v3.0
14.65k stars 2.67k forks source link

12h format in "More info" screen #6403

Open shalak opened 1 year ago

shalak commented 1 year ago

Bug Description

The "More info" screen of given message shows 12h format, even though in every other place of Signal app (and the OS itself) I have 24h format.

Steps to Reproduce

  1. Open "More info" on any message

Actual Result:

The 12h time format is shown

Expected Result:

Time format is consistent with other places of app (and OS) (i.e. 24h)

Screenshots

signal_12h_bug

Platform Info

Signal Version:

6.16.0 production (Apple silicon)

Operating System:

MacOS Ventura 13.2.1 (22D68)

Linked Device Version:

Andorid 6.19.6, although this is not applicable, as the mobile version of app doesn't have this bug.

Link to Debug Log

N/A

lamemakes commented 1 year ago

This is interesting, I'm on Fedora and my system time format is 24h format but all my signal time stamps are in 12h, not just the "More Info"

trevor-signal commented 1 year ago

Electron does not give us access to time-specific user settings, see: https://github.com/signalapp/Signal-Desktop/issues/4252, but we should be formatting times based on the locale & language of the system.

I'm guessing in this case that the region & language might be conflicting in terms of time formatting -- @shalak would you be willing to share your system region & preferred languages?

shalak commented 1 year ago

Sure, here you go:

image

And your guess was correct - when I change the preferred language to Polish, I'm getting 24h format.

nrayburn-tech commented 1 year ago

The app seems to have a few different ways of formatting dates.

https://www.electronjs.org/docs/latest/api/app#appgetpreferredsystemlanguages https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString

I think the fix here is to replace the usage of new Date().toLocaleTimeString and new Date().toLocaleDateString with a call to formatTimestamp, so that everything uses the language as determined by Electron.