en-US
Enable range selection via dRange.
zh-CN
通过 dRange 开启范围选择。
import { DDatePicker } from '@react-devui/ui';
export default function Demo() {
return (
<>
<DDatePicker dRange dClearable />
<DDatePicker dRange dClearable dShowTime />
<h5>Limit date</h5>
<DDatePicker
dRange
dClearable
dConfigDate={(date, position, current) => {
const anotherDate = current[position === 'start' ? 1 : 0];
if (anotherDate) {
return {
disabled:
anotherDate.getFullYear() !== date.getFullYear() ||
anotherDate.getMonth() !== date.getMonth() ||
Math.abs(anotherDate.getDate() - date.getDate()) > 7,
};
}
}}
/>
</>
);
}