Skip to content

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
Screen_Shot_2022-09-13_at_9.18.48_pm Screen_Shot_2022-09-14_at_3.21.24_pm

After

Pacific/Midway Australia/Melbourne
Screen_Shot_2022-09-15_at_10.03.47_pm Screen_Shot_2022-09-16_at_7.02.35_pm

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:

Project VSA seeding instructions

  1. Create a project within a group (make sure to initialize the project with a readme, or create it from a template)

  2. 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
  3. Set a timezone

  4. Important: make sure there are no query parameters in the URL, when the page loads default dates will be generated and the URL updated

  5. 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)

  6. Set another timezone that is currently on a different day

  7. 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.

Related to #205161 (closed)

Edited by Ezekiel Kigbo

Merge request reports