Repository navigation
fix(events): show and require the time zone picker when the browser reports none - #420
Merged
Merged
Conversation
…eports none
Chrome's Intl.DateTimeFormat().resolvedOptions().timeZone is undefined when
the operating system's time zone is one ICU cannot canonicalize. The form
then starts with no time zone, the picker hides itself because it rendered
only when a zone was already set, and Publish sends a create with no
timeZone. The API rejects that with a 422 ("timeZone must be a string"),
and the user has no field they can fix.
Render the picker whenever showTimeZone is set, and give it a required rule,
so the form stops at Publish with "Choose a time zone" instead of sending a
request the API will refuse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An organizer could not publish a new event. Every Publish failed with a 422 and the toast "timeZone must be a string".
Their browser gives the page no time zone. Chrome returns
undefinedfromIntl.DateTimeFormat().resolvedOptions().timeZonewhen the operating system's time zone is one ICU cannot canonicalize. The form takes its default zone from that value, so it starts with none. The time zone picker only rendered when a zone was already set, so it was hidden. Publish then sent a create with notimeZone, the API rejected it, and the user had no field to fix.Change
DatetimeComponentrenders the time zone picker whenevershowTimeZoneis set, even with no zone.Tests
DatetimeComponent.vitest.spec.ts: with no browser zone, the picker renders, requires a value, and emits the chosen zone. It stays hidden whenshowTimeZoneis false.EventFormBasicComponent.vitest.test.ts: with no browser zone, Publish does not call create. After a zone is chosen, create is sent with it. This test fails without the fix.main(calendar, profile form, date formatting, group events page). None of them come from this change.vue-tscandeslintare clean.