Skip to content

Shift the user's contribution calendar based on their timezone setting

What does this MR do and why?

As per #335343 (closed), this MR changes a user's contribution calendar to be based on their local time zone (if set in their profile), rather than the server's timezone.

Additionally to #335343 (closed), it adds support for changing the time displayed in the daily contribution list, as it wouldn't have made sense to change just the calendar and not the times themselves. It also adds hover support as shown in the screenshots to see the time in the browser's time zone for easy comparison, using some of timeago.js's functionality for this.

Screenshots or screen recordings

Browser timezone set to Sydney.

Time zone in user's profile set to UTC:

Screen_Shot_2021-10-30_at_12.10.41

Time zone in user's profile set to Sydney:

Screen_Shot_2021-10-30_at_12.11.30

Time zone in user's profile set to Pacific Time:

Screen_Shot_2021-10-30_at_12.12.18

How to set up and validate locally

In a default GDK install, seeded data for the root user has several contributions, all set to UTC timing.

  1. Visit http://127.0.0.1:3000/root and confirm the number of contributions in the calendar match what's in the database.
  2. Logged in as root, on http://127.0.0.1/-/profile change the timezone to Pacific Time.
  3. Visit http://127.0.0.1:3000/root and notice the dates in the calendar have shifted based on Pacific time.
  4. Click on one of the days with contributions in it and hover over the time on one of the contributions and confirm the tooltip is displayed correctly.

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 #335343 (closed)

Edited by David Barr

Merge request reports

Loading