question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Error while using DatePicker on edit forms.

See original GitHub issue

Describe the bug Error while using DatePicker on edit forms. Seems like there is something going wrong with dayjs and antd’s DatePicker which is default for refine.

dayjs.js:151 
Uncaught TypeError: date.locale is not a function
    at Object.format (dayjs.js:151)
    at formatValue (dateUtil.js:126)
    at useValueTexts.js:19
    at useMemo (useMemo.js:6)
    at useValueTexts (useValueTexts.js:8)
    at InnerPicker (Picker.js:135)
    at renderWithHooks (react-dom.development.js:14985)

To Reproduce Steps to reproduce the behavior:

  1. Add a new DatePicker to the edit form.
  2. Nagivate to the edit page.
  3. See error on the browser’s console.

Expected behavior No error.

Screenshots image

Desktop (please complete the following information):

  • OS: MacOS Monterey
  • Browser [Brawe]
  • Version 1.31.91 Chromium: 95.0.4638.69
  • Used dataProvider [custom]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
luizgribeirocommented, Nov 26, 2021

Just tested it out on release 2.2.3 through yarn and it worked

1reaction
turgayozgurcommented, Nov 20, 2021

@omeraplak Thanks. It worked.

  1. Use npm insted of yarn.
  2. Use the same version that refine using for dayjs. It is currently 1.10.5
  3. Don’t forget to wrap the date string value fetched from the API on getValueProps. Check it out the edit page on the example of datepicker.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Use of DatePicker in an edit form · Issue #371 - GitHub
Trying to implement DatePicker into my react application. While creating an object I have no problem at all. If I select a date...
Read more >
Trouble with using datepicker in edit form - django
I have trouble with edit data in django project. Everything is almost ok :) , but if I'm trying edit data my form...
Read more >
Can't use datepicker in form - Power Platform Community
Solved: I am trying to use a datepicker in my edit form, but I can't seem to get it to work. I can't...
Read more >
Error changing the year in the date picker - Anvil Works
Click on a date picker, change the year and click on apply. The year on the widget does not change.
Read more >
Required date field still shows error after using calendar picker
Hello,If you submit a form with a date that's required, you'll get an error as expected. If, after an error appears, you use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found