Skip to content

archives_page: respect 12h/24h setting when displaying timestamps

Jonathan Lebon requested to merge jlebon/pika-backup:pr/clock-24h into main

The %c format specifier for GDateTime's format is only based on the current locale and does not account for whether the user has customized the clock locally to use 24h or 12h formatting.

Fix this by querying the clock-format GSetting key using the Settings portal and customizing the timestamp format based on that.

I made the querying a global lazy closure based on other similar code. This does mean that once the app is started, we won't query it again. OTOH, it's not common to routinely change the clock setting, so it didn't seem worth the complexity of e.g. monitoring for changes.

The time formats encoded here match what is used by gnome-desktop itself when rendering the wall clock.

Closes: #463 (closed)

Checklist

Merge request reports