--- order: 8 title: zh-CN: 预设范围 en-US: Preset Ranges --- ## zh-CN 可以预设常用的日期范围以提高用户体验。 ## en-US We can set preset ranges to RangePicker to improve user experience. ```tsx import { DatePicker, Space } from 'antd'; import type { RangePickerProps } from 'antd/es/date-picker'; import moment from 'moment'; import React from 'react'; const { RangePicker } = DatePicker; const onChange: RangePickerProps['onChange'] = (dates, dateStrings) => { if (dates) { console.log('From: ', dates[0], ', to: ', dates[1]); console.log('From: ', dateStrings[0], ', to: ', dateStrings[1]); } else { console.log('Clear'); } }; const App: React.FC = () => ( ); export default App; ```