当前位置:网站首页>[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>
);
};
边栏推荐
猜你喜欢
随机推荐
读《IDEO,设计改变一切》有感
Cannot determine loading status from target frame detached when selenium chrome driver is running
Introduction to Graph Neural Networks (GNN) "Recommended Collection"
svg实现的树木四季变化
Get out of the machine learning world forever!
无线振弦采集仪远程修改参数方式
FreeRTOS创建任务--动态创建、静态创建
你知道图论的spfa吗?
String concatenation in SQL
消除气泡解救蘑菇h5小游戏源码
0801~面试题梳理
FreeRTOS experiment -- delete task
PGSQL database to realize the import and export
ThinkPHP 5.1反序列化分析和poc
Scala基础语法入门(三)Scala中的各种运算符
photo-sphere-viewer Chinese documentation
js半圆环加载进度动画js特效
Oracle update error operation single table rollback
selenium chrome driver运行时的cannot determine loading status from target frame detached问题
SQL中字符串拼接