import React from 'react'; import { DatePicker, Space } from 'antd'; import type { GetProps } from 'antd'; import dayjs from 'dayjs'; import customParseFormat from 'dayjs/plugin/customParseFormat'; type RangePickerProps = GetProps; dayjs.extend(customParseFormat); const { RangePicker } = DatePicker; const range = (start: number, end: number) => { const result = []; for (let i = start; i < end; i++) { result.push(i); } return result; }; // eslint-disable-next-line arrow-body-style const disabledDate: RangePickerProps['disabledDate'] = (current) => { // Can not select days before today and today return current && current < dayjs().endOf('day'); }; const disabledDateTime = () => ({ disabledHours: () => range(0, 24).splice(4, 20), disabledMinutes: () => range(30, 60), disabledSeconds: () => [55, 56], }); const disabledRangeTime: RangePickerProps['disabledTime'] = (_, type) => { if (type === 'start') { return { disabledHours: () => range(0, 60).splice(4, 20), disabledMinutes: () => range(30, 60), disabledSeconds: () => [55, 56], }; } return { disabledHours: () => range(0, 60).splice(20, 4), disabledMinutes: () => range(0, 31), disabledSeconds: () => [55, 56], }; }; const App: React.FC = () => ( ); export default App;