Skip to content

Fix initial value set on TimezoneDropdown

Diana Zubova requested to merge dz/375360-fix-timezone-edition into master

What does this MR do and why?

Show the empty timezone dropdown if the user has already preselected timezone that doesn't correspond to the one in the list.

Why? We have subset of users that have store name (Belin) of the timezone instead of the identifier (Europe/Berlin). Previous dropdown was showing no selection in this case but the current one crushes. This MR fixes this regression and replicates previous behavior.

Related to #375360 (closed)

Screenshots or screen recordings

Bug Bug fixed Normal behavior
Screenshot_2022-09-27_at_15.40.34 Screenshot_2022-09-27_at_17.12.29 Screenshot_2022-09-27_at_15.24.29

How to set up and validate locally

  1. Open the http://localhost:3000/-/profile page
  2. Update the TimeZone dropdown and save the form
  3. Make sure that the value is properly updated after safe

To test exactly bug fix: set Berlin as an initial value on a show.html.haml#L59

.js-timezone-dropdown{ data: { timezone_data: timezone_data.to_json, initial_value: 'Berlin' } }

That would simulate incorrect value that doesn't exist in the timezones list.

We should render an empty dropdown in this case.

To check deploy freeze update:

  1. Open a project, Settings -> CI/CD -> Deploy freeze
  2. Add a new deploy freeze

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Diana Zubova

Merge request reports