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

crash on disabledSeconds is not a function #694

Open
ilyas-ascend opened this issue Nov 16, 2023 · 0 comments
Open

crash on disabledSeconds is not a function #694

ilyas-ascend opened this issue Nov 16, 2023 · 0 comments

Comments

@ilyas-ascend
Copy link

ilyas-ascend commented Nov 16, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant