mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 05:29:37 +08:00
767 B
767 B
order | title | ||||
---|---|---|---|---|---|
1 |
|
zh-CN
使用 format
属性,可以自定义日期显示格式。
en-US
We can set the date format by format
.
import { DatePicker } from 'antd';
import moment from 'moment';
const { MonthPicker, RangePicker } = DatePicker;
const dateFormat = 'YYYY/MM/DD';
const monthFormat = 'YYYY/MM';
ReactDOM.render(
<div>
<DatePicker defaultValue={moment('2015/01/01', dateFormat)} format={dateFormat} />
<br />
<MonthPicker defaultValue={moment('2015/01', monthFormat)} format={monthFormat} />
<br />
<RangePicker
defaultValue={[moment('2015/01/01', dateFormat), moment('2015/01/01', dateFormat)]}
format={dateFormat}
/>
</div>
, mountNode);