File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
packages/@mantine/dates/src/components/DatePicker Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -183,9 +183,12 @@ export const DatePicker: DatePickerComponent = factory<DatePickerFactory>((_prop
183183
184184 // Sync navigation date when value changes in controlled mode
185185 useEffect ( ( ) => {
186+ // Only update navigation when component is in controlled mode (value !== undefined)
186187 if ( value !== undefined ) {
187- // For range arrays, use the first non-null date
188- const dateToNavigate = Array . isArray ( value ) ? value . find ( ( d ) => d != null ) : value ;
188+ // For range arrays, use the first non-null/non-undefined date
189+ const dateToNavigate = Array . isArray ( value )
190+ ? value . find ( ( d ) => d != null ) // != null checks both null and undefined
191+ : value ;
189192 const dateString = toDateString ( dateToNavigate ) ;
190193 if ( dateString ) {
191194 setDateRef . current ?.( dateString ) ;
You can’t perform that action at this time.
0 commit comments