Value stream analytics: generate datepicker max date in UTC
What does this MR do and why?
Ensures we generate the maxDate
in UTC. When no dates are provided via query parameters, we automatically calculate a date range from data supplied on the backend (created_before
, created_after
), these are datestrings with no TZ information, they're supposed to correspond to the start of the day and end of the day in UTC, but this currently isnt handled by the frontend. A default maxDate
is then calculated to populate the daterangepicker, which causes some confusing behaviour when its not in UTC.
This MR ensures:
- the
maxdate
stays consistent with the date range passed in the URL parameters - ensures we correctly count the
number of days selected
based on the date range
This doesnt fix issues between local time vs UTC for VSA data, a proper fix for that will involve some additional work, but this should reduce some confusing in the UI.
Note: The TZ abbreviation list was helpful.
Screenshots or screen recordings
Before
Pacific/Midway | Australia/Melbourne |
---|---|
![]() |
![]() |
After
Pacific/Midway | Australia/Melbourne |
---|---|
![]() |
![]() |
How to set up and validate locally
Timezone setup
You can test this by changing the timezone for your machine. Timezone's can also be adjusted in chrome using the sensors/location override.
Some useful timezones:
- Pacific / Midway -11 UTC
- Pacific / Tongatapu +13 UTC
Project VSA seeding instructions
-
Create a project within a group (make sure to initialize the project with a readme, or create it from a template)
-
Seed some test VSA data
$ VSA_SEED_PROJECT_ID=<project-id> VSA_ISSUE_COUNT=10 SEED_VSA=true FILTER=cycle_analytics rake db:seed_fu
-
Set a timezone
-
Important: make sure there are no query parameters in the URL, when the page loads default dates will be generated and the URL updated
-
Navigate to value stream analytics for the project, ie for a project named clean-vsa-project in group new-vsa-group it would be http://
<gdk>
/new-vsa-group/clean-vsa-project/-/value_stream_analytics (or find it in the left menu) -
Set another timezone that is currently on a different day
-
Navigate to the VSA page again (make sure there are no query parameters in the URL)
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 to #205161 (closed)