当前位置:网站首页>[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>
);
};
边栏推荐
- SQL Server 2014 installation tutorial (nanny-level graphic tutorial)
- RestTemplate 使用:设置请求头、请求体
- JS中的闭包
- SQL中字符串拼接
- Redis全部
- Introduction to Scala Basic Syntax (3) Various Operators in Scala
- Automatically generate code generator recommendation-code-gen
- This binding to detailed answers
- js cool dashboard plugin
- How to implement waterfall flow layout (what is waterfall flow layout)
猜你喜欢
A powerful js pop-up alert plugin
节省50%成本!京东云重磅发布新一代混合CDN产品
WeChat applet getPhoneNumber interface code=40013
【C语言】夏日一题 —— 如何判断素数?
图论之Kruskal,最小生成树如何优雅解题?
百日刷题计划 ———— DAY1
js半圆环加载进度动画js特效
动态组件-component
Custom mvc framework review
SQL Server 2019 installation error 0 x80004005 service there is no timely response to the start or control request a detailed solution
随机推荐
动态组件-component
There are several ways to jump to js source code, jump on the current page, jump on the blank page
js炫酷仪表盘插件
Custom mvc framework review
UAC绕过学习-总结
Mysql索引详解(图文并茂)
FreeRTOS中名称规范
First acquaintance of scrapy framework 1
Seata分布式事务
Article 48 - Analysis of timestamp2 parameters【2022-08-01】
this的绑定指向详细解答
FreeRTOS--stack experiment
Good shooting js game source code
【C语言】夏日一题 —— 如何判断素数?
SQL中字符串拼接
Interpretation of new features | MySQL 8.0 GIPK invisible primary key
自媒体创作怎样提高原创度,打造爆款作品?
Oracle update error operation single table rollback
设置代理服务器(谷歌+IE)「建议收藏」
图神经网络(GNN)的简介「建议收藏」