Skip to content

Add a user preference to show times in 12h or 24h format

What does this MR do and why?

Add a user preference to override implicit time formatting based on locale to be either 12 or 24-hour/iso time format. This MR is based on #15206 (closed).

This is automatically applied anywhere getTimeago from app/assets/javascripts/lib/utils/datetime/timeago_utility.js is being used. This results in a number of places currently using hardcoded time format strings being uneffected by the setting.

Screenshots or screen recordings

Before After
Screenshot_2023-09-02_at_19.53.46 Screenshot 2023-11-09 at 08.13.19.png
Screenshot_2023-09-02_at_20.17.35 Screenshot_2023-09-02_at_20.17.54

How to set up and validate locally

  1. Visit user preferences http://127.0.0.1:3000/-/profile/preferences
  2. Activate Show 24-hour format instead of 12-hour and deactivate Use relative times

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #15206 (closed)

Edited by Thorben Westerhuys

Merge request reports