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

Jest issue TypeError: generateConfig[fn] is not a function #755

Open
teamco opened this issue Feb 7, 2024 · 4 comments
Open

Jest issue TypeError: generateConfig[fn] is not a function #755

teamco opened this issue Feb 7, 2024 · 4 comments

Comments

@teamco
Copy link

teamco commented Feb 7, 2024

detail: TypeError: generateConfig[fn] is not a function
          at /home/frontend/node_modules/antd/node_modules/rc-picker/lib/utils/dateUtil.js:157:35
          at Array.forEach (<anonymous>)
          at forEach (/home/frontend/node_modules/antd/node_modules/rc-picker/lib/utils/dateUtil.js:153:9)
          at /home/frontend/node_modules/antd/node_modules/rc-picker/lib/PickerInput/hooks/useRangePickerValue.js:84:59
          at nextCreate (/home/frontend/node_modules/react-dom/cjs/react-dom.development.js:15846:19)
          at Object.mountMemo [as useMemo] (/home/frontend/node_modules/react-dom/cjs/react-dom.development.js:16219:16)
          at Object.useMemo (/home/frontend/node_modules/react/cjs/react.development.js:1532:21)
          at useMemo (/home/frontend/node_modules/antd/node_modules/rc-picker/lib/PickerInput/hooks/useRangePickerValue.js:80:34)
          at Picker (/home/frontend/node_modules/antd/node_modules/rc-picker/lib/PickerInput/SinglePicker.js:200:63)
@teamco
Copy link
Author

teamco commented Feb 7, 2024

"antd": "^5.13.3",
...
"rc-picker" (in deps): "3.14.6"

@teamco
Copy link
Author

teamco commented Feb 12, 2024

It seems like the error with moment.js usage
Uncaught [TypeError: generateConfig[fn] is not a function]

  • setMillisecond is not a function.
  • getMillisecond is not a function.

@teamco
Copy link
Author

teamco commented Feb 12, 2024

`
function fillTime(generateConfig, date, time) {
var tmpDate = date;
var getFn = ['getHour', 'getMinute', 'getSecond', 'getMillisecond'];
var setFn = ['setHour', 'setMinute', 'setSecond', 'setMillisecond'];
setFn.forEach(function (fn, index) {
if (time) {
tmpDate = generateConfig[fn](tmpDate, generateConfiggetFn[index]);
} else {
tmpDate = generateConfig[fn](tmpDate, 0);
}
});
return tmpDate;
}

`

@wasd0109
Copy link

wasd0109 commented Mar 4, 2024

Having the same issue, this seems to be caused by a mismatch of the rc-picker and antd dependency.
Antd uses a version of rc-picker which export a get/setMillisecond method but the specified rc-picker version does not have that method

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

2 participants