Closed elilambnz closed 4 years ago
The error message tells you which types are supported; you may use undefined
, but not null
. Is there a particular reason you need to use null
for the start and end?
There's no particular reason I need to use null
, this is simply a result of following the documentation of the DateRangePicker component. It's also used in the code example.
After a quick look at the source code, I initially thought that if I changed it to undefined
that it would break the non-null checks. But of course != null
is still falsey for undefined
. Thanks JavaScript!
Nonetheless, this still causes type errors if following exactly how the documentation does it.
Hmm sorry about that, it looks like the documentation at https://blueprintjs.com/docs/#datetime/daterangepicker.date-ranges is wrong... it should use undefined
instead of null
. Should be an easy PR to fix this!
As for the code example... null
is actually used in the component state of DateRangePickerExample
, but it is never sent to DateRangePicker
itself since the example uses the component in an "uncontrolled" manner... yeah I understand that's a bit confusing, perhaps it's worth a small refactor.
Environment
If possible, link to a minimal repro (fork this code sandbox): https://codesandbox.io/s/blueprint-sandbox-wrskg