picker icon indicating copy to clipboard operation
picker copied to clipboard

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

Open teamco opened this issue 1 year ago • 4 comments

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 avatar Feb 07 '24 11:02 teamco

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

teamco avatar Feb 07 '24 11:02 teamco

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 avatar Feb 12 '24 13:02 teamco

` 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; }

`

teamco avatar Feb 12 '24 13:02 teamco

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

wasd0109 avatar Mar 04 '24 06:03 wasd0109