简体   繁体   English

onClose,react-date-presets 在选择范围时返回未定义的 startDate,endDate。 好的,如果 select 自定义范围

[英]onClose, react-date-presets returns undefined startDate, endDate, when pick a range. OK if select custom-range

If i select a custom range, the onClose correctly return startDate and endDate but if i pick one value from the ranges it will break since returns undefined.如果我 select 自定义范围,onClose 正确返回 startDate 和 endDate 但如果我从范围中选择一个值,它将中断,因为返回未定义。

I have to find a way to grab the updated startDate and endDate inside the onClose function also if i select one range.如果我在 select 一个范围内,我也必须找到一种方法来获取 onClose function 内更新的 startDate 和 endDate 。

Here the example: https://codesandbox.io/s/clever-shamir-gyi0m?file=/src/App.js这里的例子: https://codesandbox.io/s/clever-shamir-gyi0m?file=/src/App.js

Had to modify the library, you can find a fix for this here: https://github.com/Matteobikk90/react-dates-presets不得不修改库,你可以在这里找到一个修复: https://github.com/Matteobikk90/react-dates-presets

Essentially onClose were not sending the values(startDate, endDate) if the user was selecting a range.如果用户正在选择一个范围,则基本上 onClose 不会发送值(startDate,endDate)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有日期选择器范围的 React Hook Form 不选择日期 - React Hook Form with datepicker Range doesn't pick date 仅选择开始日期或结束日期时如何处理反应日期范围(日期范围)的 onChange 事件 - How to handel event onChange of react-date-range (Date range) when only select start date or end date 如何在 react-date-range 中的日期范围 select 之后自动关闭日期范围模式 - How to auto close date range modal after date range select in react-date-range 反应日期范围创建自定义输入范围 - react-date-range create custom inputRanges REACT-如何在默认情况下将结束日期设置为与开始日期相同但控制结束日期是否不早于开始日期? - REACT- How to set enddate same as startdate by default but control if enddate not before startdate? react-dates DayPickerRangeController,如果用户在已选择时单击它,是否有办法清除 startDate 或 endDate? - react-dates DayPickerRangeController, is there a way to clean startDate or endDate if user clicks it when already selected? 反应日期范围选择器 - React Date Range Picker 如何在React中为日期范围选择选择不同的输入 - How to select different inputs for a date range selection in react 如何 select 在 react-datepicker 中设置默认日期范围 - How to select a default date range in react-datepicker 如何使 React Calendar Range 在首次呈现时不选择当前日期 - How to make React Calendar Range NOT select the current date when it first renders
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM