An unset AltDateWidget date part is undefined in every theme
Detect
- In your code, a replacement
SelectWidget, a customAltDateWidgetthat renders its own controls fromuseAltDateWidgetProps()'selements, or anonFocus/onBlurhandler that tells an unset date part by''or-1.
Change
useAltDateWidgetProps()'s elements give a part nobody has picked yet an undefined value, where the DateObject behind them holds -1, and DateElement hands the SelectWidget undefined for a -1 it is given (#5378).
Every theme's parts now report it to onFocus and onBlur as undefined, as @rjsf/core's, @rjsf/react-bootstrap's and @rjsf/mantine's already did. @rjsf/chakra-ui's reported '' and the other themes' -1.
-if (value === -1 || value === '') {
+if (value === undefined) {
Verify
Focusing and leaving an unpicked part reports undefined, and your widget shows it as unset.
Also read: