picker
picker copied to clipboard
crash on disabledSeconds is not a function
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
Here is the diff that solved my problem:
diff --git a/node_modules/rc-picker/es/hooks/useTimeSelection.js b/node_modules/rc-picker/es/hooks/useTimeSelection.js
index 9c4d47c..8f272be 100644
@@ -14,7 +14,7 @@ export default function useTimeSelection(_ref) {
var mergedHour = newHour < 0 ? generateConfig.getHour(now) : newFormattedHour;
var mergedMinute = newMinute < 0 ? generateConfig.getMinute(now) : newMinute;
var mergedSecond = newSecond < 0 ? generateConfig.getSecond(now) : newSecond;
- var newDisabledMinutes = disabledMinutes && disabledMinutes(mergedHour);
+ var newDisabledMinutes = disabledMinutes && typeof disabledMinutes=== "function" && disabledMinutes(mergedHour);
if (newDisabledMinutes !== null && newDisabledMinutes !== void 0 && newDisabledMinutes.includes(mergedMinute)) {
// find the first available minute in minutes
var availableMinute = minutes.find(function (i) {
@@ -26,7 +26,7 @@ export default function useTimeSelection(_ref) {
return null;
}
}
- var newDisabledSeconds = disabledSeconds && disabledSeconds(mergedHour, mergedMinute);
+ var newDisabledSeconds = disabledSeconds && typeof disabledSeconds === "function" && disabledSeconds(mergedHour, mergedMinute);
if (newDisabledSeconds !== null && newDisabledSeconds !== void 0 && newDisabledSeconds.includes(mergedSecond)) {
// find the first available second in seconds
var availableSecond = seconds.find(function (i) {
This issue body was partially generated by patch-package.