react-component / picker

📅 All Date Pickers you need.
https://picker.react-component.now.sh/
MIT License
257 stars 295 forks source link

Fix the first argument of the `onChange` of the `RangePicker` when values are cleared #758

Closed tnyo43 closed 4 months ago

tnyo43 commented 4 months ago

close #757

I fix the first argument of the onChange of the RangePicker when values are cleared. Currently, when I clear the values of the RangePicker, the first argument of the onChange is null. The type of the onChange is ((dates: NoUndefinedRangeValueType<Date>, dateStrings: [string, string]) => void) | undefined, so the first argument can't be null.

On the other hand, that of the onCalendarChange function is [null, null] and it makes sence if the onChange is so.

vercel[bot] commented 4 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
picker ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 9, 2024 9:46am
codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (5db4fbe) 98.57% compared to head (8bfd695) 98.53%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #758 +/- ## ========================================== - Coverage 98.57% 98.53% -0.05% ========================================== Files 63 63 Lines 2530 2529 -1 Branches 692 666 -26 ========================================== - Hits 2494 2492 -2 - Misses 33 34 +1 Partials 3 3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

tnyo43 commented 4 months ago

@zombieJ @li-jia-nan @MadCcc Could you take a look and help move this improvement forward?

zombieJ commented 4 months ago

Sorry for delay. It's by design. onChange is not same as onCalendarChange.

ref: https://github.com/react-component/picker/issues/757#issuecomment-1965675890

tnyo43 commented 3 months ago

It's by design.

Ok, if that's the case, we still have an issue with the types. I'm thinking of addressing it in another PR, so I would appreciate it if you could check it out.