Skip to content

Add time preferences to user [BE]

Problem to solve

We'd like to make displayed times in GitLab more customizable:

In order to enable these changes, we need to support these settings on the backend.

We're looking at these changes on the frontend in https://gitlab.com/gitlab-org/gitlab-ce/issues/56997.

Proposal

  • Add a user attribute to set a user's time zone.
  • Add user attributes for time display preferences:
    • Changing how times are displayed throughout the UI: 12-hour format or 24-hour format. Default to 12-hour format.
    • Changing whether or not relative times are displayed: relative or absolute.
      • Relative is "two weeks ago" vs. absolute "Sept 7th, 2019 5:00pm". Default to relative times.

We should be able to set the timezone attribute via the Users API. 12/24h and absolute/relative should be specific to the user's preferences and shouldn't be modifiable via the API (since they only apply to the UI).

We'll also probably need a migration to update this/set defaults for existing users.

Edited by Jeremy Watson (ex-GitLab)