Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dateTime mode switch should trigger onCalendarChange #669

Merged
merged 9 commits into from
Sep 13, 2023

Conversation

Yuiai01
Copy link
Contributor

@Yuiai01 Yuiai01 commented Aug 23, 2023

close ant-design/ant-design#44280

问题出现原因:
在设置了 showTime 和 changeOnBlur 后,在没有点击确认按钮时点击输入框切换选择开始或结束日期时不会触发对应的 onChange 事件,因此 disabledDate 就失效了,导致最终可以选择出不符合 disabledDate 的时间范围。

解决思路:
去触发切换前输入框的 onCalendarChange 事件。

ref:
ant-design/ant-design#24704
ant-design/ant-design#30467
ant-design/ant-design#31261

@vercel
Copy link

vercel bot commented Aug 23, 2023

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 Sep 6, 2023 9:43am

@codecov
Copy link

codecov bot commented Aug 23, 2023

Codecov Report

Merging #669 (510cf2b) into master (0ea23cd) will decrease coverage by 0.12%.
Report is 2 commits behind head on master.
The diff coverage is 100.00%.

❗ Current head 510cf2b differs from pull request most recent head 25b4fac. Consider uploading reports for the commit 25b4fac to get more accurate results

@@            Coverage Diff             @@
##           master     #669      +/-   ##
==========================================
- Coverage   99.05%   98.93%   -0.12%     
==========================================
  Files          56       56              
  Lines        2431     2442      +11     
  Branches      735      741       +6     
==========================================
+ Hits         2408     2416       +8     
- Misses         21       24       +3     
  Partials        2        2              
Files Changed Coverage Δ
src/RangePicker.tsx 99.29% <100.00%> (+0.01%) ⬆️
src/hooks/usePickerInput.ts 98.71% <100.00%> (ø)
src/hooks/useTimeSelection.ts 73.07% <100.00%> (-10.93%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Yuiai01 Yuiai01 changed the title fix: disabledDate not wwork when using both showTime and changeOnBlur fix: disabledDate not work when using both showTime and changeOnBlur Aug 23, 2023
@zombieJ
Copy link
Member

zombieJ commented Aug 24, 2023

看起来切换的时候应该触发一次 onCalendarChange

@Yuiai01
Copy link
Contributor Author

Yuiai01 commented Aug 24, 2023

看起来切换的时候应该触发一次 onCalendarChange

嗯嗯,目前在切换的时候会触发一次 onCalendarChange

src/RangePicker.tsx Outdated Show resolved Hide resolved
@Yuiai01 Yuiai01 changed the title fix: disabledDate not work when using both showTime and changeOnBlur fix: dateTime mode switch should trigger onCalendarChange Sep 1, 2023
src/RangePicker.tsx Outdated Show resolved Hide resolved
src/RangePicker.tsx Outdated Show resolved Hide resolved
src/RangePicker.tsx Outdated Show resolved Hide resolved
@zombieJ zombieJ merged commit e1e0d09 into react-component:master Sep 13, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants