当前位置:网站首页>[typescript] Use the RangePicker component in antd to implement time limit the previous year (365 days) of the current time
[typescript] Use the RangePicker component in antd to implement time limit the previous year (365 days) of the current time
2022-08-02 13:12:00 【Sco_Jing1031】
//先导入组件
import {
DatePicker } from 'antd';
import moment from 'moment';
const {
RangePicker } = DatePicker;
/**Operation time drop-down item */
const renderTimeSelect = () => {
/**The optional range is the most recent year */
const disabledDate = (m: Moment) =>
(m && m.isAfter(moment().endOf('day'))) ||
(m &&
m.isBefore(
moment()
.subtract(1, 'year')
.startOf('day'),
));
return (
<Form.Item label="操作时间">
{
getFieldDecorator('operationTime', {
initialValue: [
moment()
.subtract(30, 'days')
.startOf('day'),
moment(),
],
})(
<RangePicker
allowClear={
false}
showTime
format="YYYY-MM-DD HH:mm"
disabledDate={
disabledDate as any}
onOk={
() => {
LX(get(operationRecordLx, `operationTime.${
source}`));
}}
/>,
)}
</Form.Item>
);
};
边栏推荐
猜你喜欢
js半圆环加载进度动画js特效
RISC-V 指令格式和6种基本整数指令
WeChat applet getPhoneNumber interface code=40013
你知道图论的spfa吗?
图论之Kruskal,最小生成树如何优雅解题?
为什么IDEA连接mysql Unable to resolve table 编译报错但是可以运行
In-depth analysis and use of Ribbon load balancing
First acquaintance of scrapy framework 1
Openlayers Quick Start Tutorial
js stopwatch countdown plugin
随机推荐
80篇国产数据库实操文档汇总(含TiDB、达梦、openGauss等)
photo-sphere-viewer Chinese documentation
FreeRTOS实验--一个函数创建多个任务
3 ways for OpenFeign to set headers
js九宫格样式抽奖插件
短视频美食自媒体怎么做?5步教你快速上手
WPF效果第一百九十三篇之登录实现
智能手表前景如何?
PHP+MYSQL [Student Information Management System] (Minimalist Edition)
SQL中字符串拼接
我的创作纪念日
工厂方法模式
Name conventions in FreeRTOS
js true 3d histogram plugin
sql concat() function
RESTful style (detailed introduction + case implementation)
FreeRTOS中名称规范
First acquaintance of scrapy framework 1
Intouch System Platform IDE-1
Get out of the machine learning world forever!