-
-
Notifications
You must be signed in to change notification settings - Fork 50.3k
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
form.setFieldsValue 之后再去选择日期 出错clone.weekday is not a function #26190
Comments
please provide a codesandbox link |
Hello @KouSum. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro or a minimal GitHub repository. Issues labeled by 你好 @KouSum, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。7 天内未跟进的 issue 将会被自动关闭。 |
重装依赖包后就好了 |
我也遇到这个问题了,回显之后,在编辑就报错 |
我yongdayjs时也遇到了,请问解决了吗 |
我也遇到了同样的问题 |
4.5.0版本更新打破了dayjs的实现。这似乎适用于4.4.3 |
I have the same problem with datepicker, any update? |
把项目中的 day.js 改成 moment.js 完美解决,就是 moment.js 太大了 |
Having the same issue here. |
update lastest version dayjs |
@crownclownwl moment.js is not recommended to use now, dayjs is the recommended to use |
@hoangmeo I'm using the lastest version |
found a way to do this.
I guess DatePicker would use these dayjs plugins so you would have to add these plugins yourself. |
This is an issue with rc-picker: react-component/picker#123 |
The required plugins should probably be listed on that "Replace Moment.js" page IMO |
@iamkun Should we update documentation? |
https://ant.design/docs/react/replace-moment-cn should include these additional Day.js plugins. |
Correct, and I'll update |
After digging this issue, it is actually because there are TWO Day.js package installed in SOLUTION:
|
this solution can resolute my project. but the dayjs instance maybe not in your node_modules, it could build in another package that it would not the same dayjs and the rc-picker import |
Yeah, that isn't working no matter how many times I nuke my package-lock.json and node_modules. The
|
@PipBoy2000 Thanks, fixed in react-component/picker#214 |
I believe we will wait until ant-design update rc-picker version right? P.S: No we don't. Clearing the lock and node_modules and than installing the packages again solved my problem. Thanks everyone who rised and worked on this issue. |
Solved my problem |
Reproduction link
[https://ant.design/docs/react/replace-moment-cn 按照此教程替换 Moment.js为dayjs ](https://ant.design/docs/react/replace-moment-cn 按照此教程替换 Moment.js为dayjs )
Steps to reproduce
按照教程替换 Moment.js为dayjs form中使用RangePicker form.setFieldsValue 之后再去选择日期 出错clone.weekday is not a function
What is expected?
form.setFieldsValue之后可以正常选择日期
What is actually happening?
出错clone.weekday is not a function
部分错误提示
dayjs.js:73
Uncaught TypeError: clone.weekday is not a function
at Object.getWeekDay (dayjs.js:73)
at getWeekStartDate (dateUtil.js:97)
at DateBody (DateBody.js:21)
at renderWithHooks (react-dom.development.js:14803)
at mountIndeterminateComponent (react-dom.development.js:17482)
at beginWork (react-dom.development.js:18596)
at HTMLUnknownElement.callCallback (react-dom.development.js:188)
at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
at invokeGuardedCallback (react-dom.development.js:292)
at beginWork$1 (react-dom.development.js:23203)
at performUnitOfWork (react-dom.development.js:22154)
at workLoopSync (react-dom.development.js:22130)
at performSyncWorkOnRoot (react-dom.development.js:21756)
at react-dom.development.js:11089
at unstable_runWithPriority (scheduler.development.js:653)
at runWithPriority$1 (react-dom.development.js:11039)
at flushSyncCallbackQueueImpl (react-dom.development.js:11084)
at flushSyncCallbackQueue (react-dom.development.js:11072)
at discreteUpdates$1 (react-dom.development.js:21893)
at discreteUpdates (react-dom.development.js:806)
at dispatchDiscreteEvent (react-dom.development.js:4168)
The text was updated successfully, but these errors were encountered: