Comments (2)
I don't know if you still have issues with it but what I discovered about this issue is that the Date
library (Moment/date-fns/dayjs) is not properly imported. To solve that, just import from one of the existing ones and pass as a prop the generateConfig
such as:
import Picker from 'rc-picker';
import 'rc-picker/assets/index.css';
import momentGenerateConfig from 'rc-picker/lib/generate/moment'; // here
const MyPicker = () => <Picker generateConfig={momentGenerateConfig} />
Turns out that this leads to another issue with locale
, so I also needed to import that and the final code looks similar to:
import Picker from 'rc-picker';
import 'rc-picker/assets/index.css';
import momentGenerateConfig from 'rc-picker/lib/generate/moment';
import enUS from 'rc-picker/lib/locale/en_US';
const MyPicker = () => <Picker generateConfig={momentGenerateConfig} locale={enUS} />
You can also look at some examples inside the examples dir 😄
from picker.
当我在umi创建的react项目中,使用re-picker这个插件来添加时间选择器的时候,点击输入框,出现了以下问题:
PickerPanel.js:123 Uncaught TypeError: Cannot read property 'getNow' of undefined
devScripts.js:5931 The above error occurred in the component:
具体可以查看下面图片和视频
import styles from './index.less';
import Picker from 'rc-picker';
import 'rc-picker/assets/index.css';
export default function IndexPage() {
return (
<div>
<h1 className={styles.title}>Page index</h1>
<Picker />
</div>
);
}
iShot2021-04-13.22.04.49.mov
from picker.
Related Issues (20)
- 是否可以增加title
- 文档是否能加上相关浏览器的兼容性
- Picker with Luxon config raises "Error: Invalid DateTime: unparsable: the input "2023-1-01" can't be parsed as format yyyy-MM-dd"
- RangePicker inputRender prop HOT 1
- Can "format" take effect on the title attribute?
- crash on disabledSeconds is not a function
- Support `onClear`
- Deprecated event.which property HOT 1
- 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 属性在选择年的时候 有异常
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.