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:
After:
How to set up and validate locally
- Adjust your timezone through the OS settings to
Asia/Kolkata
- Create a Group so you're the owner of it
- Visit Group > Settings > Usage Quotas and view the Pipeline and Shared Runner minute charts
- Observe that current month (May 2022) is displayed as the last label and data point
- Adjust your timezone through the OS settings to
America/Toronto
- Visit Group > Settings > Usage Quotas and view the Pipeline and Shared Runner minute charts
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related customer support ticket (interval link): https://gitlab.zendesk.com/agent/tickets/282755