feat: add timezone selector to selection plan edit page#800
feat: add timezone selector to selection plan edit page#800
Conversation
Allow users to choose a display timezone for date/time fields on the selection plan form instead of being locked to the summit timezone. Defaults to the summit timezone on load. Dates are still sent to the API as UTC epoch timestamps, so this is a client-only change. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds a user-selectable timezone dropdown to the selection plan form, wires Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Redux as Redux State
participant Page as EditSelectionPlanPage
participant Form as SelectionPlanForm
participant Picker as DateTimePicker
Redux->>Page: provide `timezones`, `currentSummit`
Page->>Form: pass props (`timezones`, `currentSummit`, ...)
Form->>Form: initialize `selectedTimezone = currentSummit.time_zone_id`
Form->>Picker: render DateTimePicker using `selectedTimezone`
Note over Form,Picker: User changes timezone via dropdown
Form->>Form: update `selectedTimezone`
Form->>Picker: re-render DateTimePicker with new timezone
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/components/forms/selection-plan-form.js (1)
141-157:selectedTimezoneis not reset when the edited entity changes.
componentDidUpdateresetsentityanderrorswhenprops.entitychanges (i.e., when the user navigates from one selection plan to another within the same SPA session), but it never resetsselectedTimezoneback toprops.currentSummit.time_zone_id. This means a previously user-chosen non-default timezone silently persists for the newly loaded plan's date fields, contradicting the documented behaviour ("defaults to the summit timezone").♻️ Proposed fix — reset timezone on entity change
if (!shallowEqual(prevProps.entity, this.props.entity)) { state.entity = { ...this.props.entity }; state.errors = {}; + state.selectedTimezone = this.props.currentSummit.time_zone_id; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/forms/selection-plan-form.js` around lines 141 - 157, When props.entity changes in componentDidUpdate (the block that already sets state.entity and state.errors), also reset selectedTimezone back to the summit default by setting state.selectedTimezone = this.props.currentSummit.time_zone_id (or props.currentSummit.time_zone_id) so the new entity uses the summit timezone; ensure this key is included in the same state object merged into setState alongside entity and errors (reference componentDidUpdate, selectedTimezone, and props.currentSummit.time_zone_id).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/forms/selection-plan-form.js`:
- Line 330: timezoneDdl creation currently calls timezones.map(...) which throws
if timezones is undefined; change the code that builds timezoneDdl (symbol:
timezoneDdl) to defensively handle undefined by using a safe default (e.g.,
treat timezones as an empty array before mapping) or ensure baseState.timezones
is initialized in the reducer/props; update the mapping site that references
timezones (prop: timezones / baseState.timezones) to use a fallback like
(timezones || []) so timezoneDdl always receives an array.
---
Nitpick comments:
In `@src/components/forms/selection-plan-form.js`:
- Around line 141-157: When props.entity changes in componentDidUpdate (the
block that already sets state.entity and state.errors), also reset
selectedTimezone back to the summit default by setting state.selectedTimezone =
this.props.currentSummit.time_zone_id (or props.currentSummit.time_zone_id) so
the new entity uses the summit timezone; ensure this key is included in the same
state object merged into setState alongside entity and errors (reference
componentDidUpdate, selectedTimezone, and props.currentSummit.time_zone_id).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Test plan
/app/summits/70/selection-plans/67)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Localization
Bug Fixes