picker icon indicating copy to clipboard operation
picker copied to clipboard

GenerateConfig is not undefined

Open lian8306 opened this issue 4 years ago • 2 comments

Is there anyone find that, Generateconfig is passed in through props, but there is no API description. As a result, the value of generateconfig is undefined and an error will be reported when using it.

Use according to novice guidelines

`export default function IndexPage() {

return (

  <Picker />

); }`

there will be a error,because Generateconfig is undefined `TypeError: Cannot read property 'locale' of undefined formatValue ./node_modules/rc-picker/es/utils/dateUtil.js:126 123 | var generateConfig = _ref.generateConfig, 124 | locale = _ref.locale, 125 | format = _ref.format;

126 | return typeof format === 'function' ? format(value) : generateConfig.locale.format(locale.locale, value, format); 127 | } 128 | export function parseValue(value, _ref2) { 129 | var generateConfig = _ref2.generateConfig, View compiled`

Is that mean we should give Generateconfig a default value from generate

lian8306 avatar Feb 09 '21 06:02 lian8306

Try this: import generateConfig from "rc-picker/lib/generate/(lib)" lib can be dayjs dateFn or moment, depends and the date library you prefer use

yioneko avatar Apr 01 '21 12:04 yioneko

I made a reply to an issue similar to this one. If you want, it is possible to check it here.

Also, as this is the second issue with the same question maybe could be a good thing to make a reference to it inside the docs/readme. I could open a PR of it! 😄

caiangums avatar Jan 31 '22 14:01 caiangums