Comments (14)
@jstaro found a way to do this.
import dayjs from 'dayjs'
import advancedFormat from 'dayjs/plugin/advancedFormat'
import customParseFormat from 'dayjs/plugin/customParseFormat'
import localeData from 'dayjs/plugin/localeData'
import weekday from 'dayjs/plugin/weekday'
import weekOfYear from 'dayjs/plugin/weekOfYear'
import weekYear from 'dayjs/plugin/weekYear'
dayjs.extend(customParseFormat)
dayjs.extend(advancedFormat)
dayjs.extend(weekday)
dayjs.extend(localeData)
dayjs.extend(weekOfYear)
dayjs.extend(weekYear)
from picker.
This workaround solves the issue without having to downgrade dayjs:
ant-design/ant-design#26190 (comment)
Those lines should be added into this library.
from picker.
This is still an issue. Please lock dayjs version to 1.8.30
from picker.
dayjs => 1.11.9
在没有使用导入dayjs自带国际化配置时候是正常的 导入后就出现了 。
使用上面 @iMuFeng 这个办法可以愉快工作。
我只是一个菜鸟程序员,从这段修补代码方式上我感觉是导出的dayjs覆盖了原有的DatePicker中的dayjs。
"It was working fine without importing the built-in internationalization configuration of dayjs, but after importing it, the issue occurred. Using the method mentioned above seems to work well. I'm just a novice programmer, but based on this code patch, it seems that the imported dayjs is overriding the original dayjs used in the DatePicker."
from picker.
@jstaro found a way to do this.
import dayjs from 'dayjs' import advancedFormat from 'dayjs/plugin/advancedFormat' import customParseFormat from 'dayjs/plugin/customParseFormat' import localeData from 'dayjs/plugin/localeData' import weekday from 'dayjs/plugin/weekday' import weekOfYear from 'dayjs/plugin/weekOfYear' import weekYear from 'dayjs/plugin/weekYear' dayjs.extend(customParseFormat) dayjs.extend(advancedFormat) dayjs.extend(weekday) dayjs.extend(localeData) dayjs.extend(weekOfYear) dayjs.extend(weekYear)
it's work
from picker.
Same here.
from picker.
I want to be able to use dayjs v1.9.x because they've fixed a slew of timezone-related issues from 1.8.3x, but it appears this library makes it impossible to use v1.9.x for now.
from picker.
@jstaro check my previous comment, you can use the latest dayjs by adding these lines. It worked for me with dayjs 1.9.3.
from picker.
@marian2js Yes I tried doing that, but it doesn't seem to work with the latest version of AntD (which relies on rc-picker
) and the way antd-dayjs-webpack-plugin
loads dayjs
, it seems.
from picker.
@iMuFeng Thank you for the workaround. I will keep that in mind if we need it again! For now, we migrated our user code to use Luxon and only treat dayjs as a follow-along dependency of AntDesign, since we cannot fully control the version used.
from picker.
Any update?
from picker.
same error
from picker.
@jstaro found a way to do this.
import dayjs from 'dayjs' import advancedFormat from 'dayjs/plugin/advancedFormat' import customParseFormat from 'dayjs/plugin/customParseFormat' import localeData from 'dayjs/plugin/localeData' import weekday from 'dayjs/plugin/weekday' import weekOfYear from 'dayjs/plugin/weekOfYear' import weekYear from 'dayjs/plugin/weekYear' dayjs.extend(customParseFormat) dayjs.extend(advancedFormat) dayjs.extend(weekday) dayjs.extend(localeData) dayjs.extend(weekOfYear) dayjs.extend(weekYear)
thank you, it's work
from picker.
I wonder why this is still the issue 😳, there is lack of information inside the official docs 😞
I created adapter based only your solution, so it's more elegant to import inside components:
// this is adapter for antd datepicker
// import it instead of the original dayjs
// more info here: https://github.com/react-component/picker/issues/123#issuecomment-728755491
import dj from 'dayjs'
import advancedFormat from 'dayjs/plugin/advancedFormat'
import customParseFormat from 'dayjs/plugin/customParseFormat'
import localeData from 'dayjs/plugin/localeData'
import weekday from 'dayjs/plugin/weekday'
import weekOfYear from 'dayjs/plugin/weekOfYear'
import weekYear from 'dayjs/plugin/weekYear'
dj.extend(customParseFormat)
dj.extend(advancedFormat)
dj.extend(weekday)
dj.extend(localeData)
dj.extend(weekOfYear)
dj.extend(weekYear)
export const dayjs = dj;
from picker.
Related Issues (20)
- rangepicker不支持受控
- When using date-fns, all locales are imported HOT 2
- Add property to remain position after picking a value
- Jest issue TypeError: generateConfig[fn] is not a function HOT 4
- the parameter of `onChange` is wrong when I click cancel button in `RangePicker` HOT 2
- TypeScript error in SinglePickerPanelProps interface during build process HOT 4
- "version": "4.3.0" ref转发的blur方法需要调用
- onCalendarChange is called with wrong value if only one value set in RangePicker
- Why the locale ko-KR uses dayFormat 'Do' as other locales don't?
- When selecting values in panel with type different than the picker type dates are auto-selected.
- picker3.14.6版本 TS1005
- DatePicker 中的 disabledDate 属性在选择年的时候 有异常
- V4.4.2 版本 TimePicker.RangePicker 样式问题
- Entering date manually in custom date-fns date picker with format
- TimePicker panel will keep scrolling after select a time. HOT 1
- Changelog is not updated since 2.4.3 HOT 1
- AM/PM is not localized in Picker Panel list for JA
- feature request: provide interfaces to set custom words to aria-labels of `DatePicker`
- Tajik languange HOT 2
- disableDate在year界面错误展示
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from picker.