mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 09:49:57 +08:00
6776bb8916
* docs: update demo * chore: add script * test: fix demo test * docs: convert demos * chore: move script * test: remove react-dom import * chore: update deps * docs: update riddle js * test: fix image test * docs: fix riddle demo
1007 B
1007 B
order | title | ||||
---|---|---|---|---|---|
8 |
|
zh-CN
可以预设常用的日期范围以提高用户体验。
en-US
We can set preset ranges to RangePicker to improve user experience.
import { DatePicker, Space } from 'antd';
import moment from 'moment';
const { RangePicker } = DatePicker;
function onChange(dates, dateStrings) {
console.log('From: ', dates[0], ', to: ', dates[1]);
console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]);
}
export default () => (
<Space direction="vertical" size={12}>
<RangePicker
ranges={{
Today: [moment(), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
}}
onChange={onChange}
/>
<RangePicker
ranges={{
Today: [moment(), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
}}
showTime
format="YYYY/MM/DD HH:mm:ss"
onChange={onChange}
/>
</Space>
);