You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to set undefined or null as date value but it is prevented by validation. If i comment that line eveything is working fine.
If unselect the date in the datepicker by clicking on the current selected date, the onChange Event is never fired. So i never know how the state of the picker is.
Reproducible sample code
<DateTimePickerstyle={styles.datePicker}value={null}// NOT POSSIBLE to set NULLdisplay="calendar"firstDayOfWeek={1}onChange={(event: DateTimePickerEvent,date?: Date)=>{// NOT FIRED if unselect the date}}onError={(arg: Error)=>console.log('GKUDateError',arg)}/>
Steps to reproduce
--
Describe what you expected to happen:
Null as initial value should be allows
Validation for value in utils.js should be removed because it is already checked. And if i remove the init validation (sharedPropsValidation) everything works fine:
exportdefaultfunctionRNDateTimePickerQWE(props: WindowsNativeProps,): React.Node{sharedPropsValidation({value: props?.value});// **REMOVING THIS LINE FIXES THE ISSUE** constlocalProps={dayOfWeekFormat: props.dayOfWeekFormat,dateFormat: props.dateFormat,firstDayOfWeek: props.firstDayOfWeek,maxDate: props.maximumDate ? props.maximumDate.getTime() : undefined,// time in millisecondsminDate: props.minimumDate ? props.minimumDate.getTime() : undefined,// time in millisecondsonChange: props.onChange,placeholderText: props.placeholderText,selectedDate: props.value ? props.value.getTime() : undefined,// time in millisecondsstyle: [styles.rnDatePicker,props.style],};
...
Environment info
npx react-native info output:
System:
OS: Windows 10 10.0.22621
CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
Memory: 13.63 GB / 31.73 GB
Binaries:
Node:
version: 16.19.1
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 3.6.0
path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm:
version: 8.19.3
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions:
- 10.0.18362.0
- 10.0.19041.0
- 10.0.22000.0
- 10.0.22621.0
IDEs:
Android Studio: AI-222.4459.24.2221.10121639
Visual Studio:
- 17.5.33502.453 (Visual Studio Community 2022)
- 16.11.33423.256 (Visual Studio Community 2019)
Languages:
Java: Not Found
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.4
wanted: 0.72.4
react-native-windows:
installed: 0.72.7
wanted: 0.72.7
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
datetimepicker version: 4.5.0
React Native Windows
The text was updated successfully, but these errors were encountered:
I have the same problem: I use this package for forms and in some of them I would like to unselect/erase the date.
I have no workaround for the moment 😕
Bug report
Summary
datetimepicker.windows.js
undefined
ornull
as date value but it is prevented by validation. If i comment that line eveything is working fine.Reproducible sample code
Steps to reproduce
--
Describe what you expected to happen:
Environment info
npx react-native info
output:datetimepicker version: 4.5.0
React Native Windows
The text was updated successfully, but these errors were encountered: