Dayjs DatePicker doesn't respect Day.js locale from Config Provider (nextjs)
See original GitHub issue- [ v] I have searched the issues of this repository and believe that this is not a duplicate.
Related but doesn’t work for me: https://github.com/ant-design/ant-design/issues/27815
Reproduction link
https://github.com/chemicalkosek/antd-dayjs-next
Steps to reproduce
- Clone repository
- Launch with npm run dev
- See that the Datepicker with inline locale setup works. The other one doesn’t respect the ConfigProvider (or actually the days locale)
- If without stopping the dev server I change
lib
toes
in the line:
import generatePicker from "antd/lib/date-picker/generatePicker";
to:
import generatePicker from "antd/es/date-picker/generatePicker";
I can see now with hot refresh that it works!
All the week names etc are in pl
locale.
But If I refresh the page or stop the dev server and run again npm run dev
(or build to production), I’l get the following error:
/home/maciek/Dokumenty/websites/antd-dayjs-next/node_modules/antd/es/date-picker/generatePicker/index.js:1
import _extends from "@babel/runtime/helpers/esm/extends";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:979:16)
at Module._compile (internal/modules/cjs/loader.js:1027:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at eval (webpack-internal:///antd/es/date-picker/generatePicker:1:18)
at Object.antd/es/date-picker/generatePicker (/home/maciek/Dokumenty/websites/antd-dayjs-next/.next/server/pages/index.js:149:1)
at __webpack_require__ (/home/maciek/Dokumenty/websites/antd-dayjs-next/.next/server/pages/index.js:23:31)
at eval (webpack-internal:///./components/DayjsDatePicker.js:4:92)
at Module../components/DayjsDatePicker.js (/home/maciek/Dokumenty/websites/antd-dayjs-next/.next/server/pages/index.js:104:1)
at __webpack_require__ (/home/maciek/Dokumenty/websites/antd-dayjs-next/.next/server/pages/index.js:23:31)
at eval (webpack-internal:///./pages/index.js:9:85)
at Module../pages/index.js (/home/maciek/Dokumenty/websites/antd-dayjs-next/.next/server/pages/index.js:127:1)
at __webpack_require__ (/home/maciek/Dokumenty/websites/antd-dayjs-next/.next/server/pages/index.js:23:31)
What is expected?
The dayjs locale works in dayjs Date Picker
What is actually happening?
The default english dayjs locale is seen
Environment | Info |
---|---|
antd | 4.14.1 |
React | 17.0.2 |
System | Ubuntu 20.04 |
Browser | Chrome 89 |
Issue Analytics
- State:
- Created 2 years ago
- Reactions:10
- Comments:11 (1 by maintainers)
Top Results From Across the Web
dayjs with i18next set locale not working - Stack Overflow
but its not working, I get only the english format. ... import dayjs from 'dayjs'; const { t, i18n } = useTranslation(); dayjs.locale(i18n....
Read more >Changelog - Contentful
The changelog is a log or record of all notable changes made to the Contentful app | Subscribe via RSS | Filter by...
Read more >@mui/system | Yarn - Package Manager
CSS utilities for rapidly laying out custom designs. Installation. Install the package in your project directory with: // with npm npm install @mui/system...
Read more >material-ui/core/CHANGELOG.md - UNPKG
71, v4 doesn't have official support for React 17 like v5 has. ... 827, - [docs] Next.js: Remove unused config files (#20382) @HaNdTriX....
Read more >YourIR Documentation
We will also record all your stocks in your setup, so that YourIR inputs and stock ... Volume Weight Average Price over the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any updates here?
Up