实现效果
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/0c80695a439c20f253691cef08dc4899.gif#pic_center)
实现代码
import React from "react";
import "antd/dist/antd.css";
import "./index.css";
import { DatePicker, Space } from "antd";
import type { RangePickerProps } from "antd/es/date-picker";
import moment from "moment";
const { RangePicker } = DatePicker;
const App: React.FC = () => (
<Space direction="vertical" size={12}>
<RangePicker
showTime={{
showNow: true,
hideDisabledOptions: true,
defaultValue: [
moment("00:00:00", "HH:mm:ss"),
moment("23:59:59", "HH:mm:ss")
]
}}
ranges={{
此刻: [moment(), moment()],
今天: [moment("00:00:00", "HH:mm:ss"), moment("23:59:59", "HH:mm:ss")]
}}
format="YYYY-MM-DD HH:mm:ss"
/>
</Space>
);
export default App;