util: Always use 12h format if requested
Whether we show times in 12h format currently depends on: - the 'clock-format' desktop setting - the locale support for AM/PM This was consist with other GNOME components, however both the WallClock[0] and the Date+Time Settings panel[1] dropped the second check after GDateTime started supporting AM/PM independently from the locale, so we should follow suite. [0] https://git.gnome.org/browse/gnome-desktop/commit?id=226fe725ef2cb2 [1] https://git.gnome.org/browse/gnome-control-center/commit?id=85cd910af https://bugzilla.gnome.org/show_bug.cgi?id=782930
This commit is contained in:
parent
a55599a239
commit
817ff52414
@ -87,7 +87,7 @@ GOBJECT_INTROSPECTION_MIN_VERSION=1.49.1
|
|||||||
GJS_MIN_VERSION=1.47.0
|
GJS_MIN_VERSION=1.47.0
|
||||||
MUTTER_MIN_VERSION=3.25.1
|
MUTTER_MIN_VERSION=3.25.1
|
||||||
GTK_MIN_VERSION=3.15.0
|
GTK_MIN_VERSION=3.15.0
|
||||||
GIO_MIN_VERSION=2.45.3
|
GIO_MIN_VERSION=2.53.0
|
||||||
LIBECAL_MIN_VERSION=3.5.3
|
LIBECAL_MIN_VERSION=3.5.3
|
||||||
LIBEDATASERVER_MIN_VERSION=3.17.2
|
LIBEDATASERVER_MIN_VERSION=3.17.2
|
||||||
POLKIT_MIN_VERSION=0.100
|
POLKIT_MIN_VERSION=0.100
|
||||||
|
@ -218,11 +218,10 @@ function formatTime(time, params) {
|
|||||||
if (_desktopSettings == null)
|
if (_desktopSettings == null)
|
||||||
_desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
_desktopSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
|
||||||
let clockFormat = _desktopSettings.get_string('clock-format');
|
let clockFormat = _desktopSettings.get_string('clock-format');
|
||||||
let hasAmPm = date.format('%p') != '';
|
|
||||||
|
|
||||||
params = Params.parse(params, { timeOnly: false });
|
params = Params.parse(params, { timeOnly: false });
|
||||||
|
|
||||||
if (clockFormat == '24h' || !hasAmPm) {
|
if (clockFormat == '24h') {
|
||||||
// Show only the time if date is on today
|
// Show only the time if date is on today
|
||||||
if (daysAgo < 1 || params.timeOnly)
|
if (daysAgo < 1 || params.timeOnly)
|
||||||
/* Translators: Time in 24h format */
|
/* Translators: Time in 24h format */
|
||||||
|
Loading…
Reference in New Issue
Block a user