mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-29 03:48:26 +08:00
5e298dba51
* add responsive property to carousel (#15071) * add responsive property to carousel #15065 * extend carousel props from Slick type definitions #15065 * rm key in OptionProps (#15104) * update doc * fix cascader should tab twice to exist (#15117) * fix cascader should tab twice to exist * update snapshot * Drawer Body padding should be variable * fix DatePicker to support an array of formats (#15116) ref #13148 * table reader mobile friendly * up * up * doc: add 3.14.0 changelog * doc: fix ci warning * doc: fix ci warning * doc: fix typo * doc: fix ci warning * doc: fix ci warning * doc: fix cr warring * doc: fix cr warring * doc: fix cr warring * doc: fix cr warring * doc: fix cr warring * doc: fix cr warring * doc: fix cr warring * -m * -m * doc: fix cr warning
931 B
931 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';
const dateFormatList = ['DD/MM/YYYY','DD/MM/YY']
ReactDOM.render(
<div>
<DatePicker defaultValue={moment('2015/01/01', dateFormat)} format={dateFormat} />
<br />
<DatePicker defaultValue={moment('01/01/2015', dateFormatList[0])} format={dateFormatList} />
<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
);