Skip to content

Format dates as UTC

What does this MR do and why?

Group - Settings - Usage Quotas:

  • Pipelines tab
  • Shared runner usage tab

In the month based charts displayed on both of the above pages the backend sends us UTC dates representing start of month such as 2022-01-01.

When transforming these into an mmm yyyy format within the frontend we do not explicitly mention to the formatting library that they need to be treated as UTC dates so the browser's timezone environment instead influences the result.

For timezones in the 'west', or anything that's GMT minus n the formatted month becomes incorrect and shows the prior month because of the negative offset applying on the first second of the date.

This change forces the formatting to treat the dates passed as UTC and adds tests that fail without the fixes added.

Screenshots or screen recordings

Before:

image

After:

image

How to set up and validate locally

  1. Adjust your timezone through the OS settings to Asia/Kolkata
  2. Create a Group so you're the owner of it
  3. Visit Group > Settings > Usage Quotas and view the Pipeline and Shared Runner minute charts
  4. Observe that current month (May 2022) is displayed as the last label and data point
  5. Adjust your timezone through the OS settings to America/Toronto
  6. Visit Group > Settings > Usage Quotas and view the Pipeline and Shared Runner minute charts
  7. Observe that previous month (April 2022) is displayed as the last label and data point

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 customer support ticket (interval link): https://gitlab.zendesk.com/agent/tickets/282755

Edited by Harsh Chouraria

Merge request reports

Loading