当前位置:网站首页>[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>
);
};
边栏推荐
猜你喜欢
随机推荐
移动端适配,华为浏览器底色无法正常显示
【C语言】夏日一题 —— 求最大公约数和最小公倍数
js真3d柱状图插件
pytorch model to tensorflow model
Taurus.MVC V3.0.3 microservice open source framework released: Make the evolution of .NET architecture easier in large concurrency.
package.json and package-lock.json
FreeRTOS创建任务--动态创建、静态创建
FreeRTOS creation tasks - dynamic creation, static creation
svg balloon rises explosion js special effect
0801~面试题梳理
图神经网络(GNN)的简介「建议收藏」
短视频美食自媒体怎么做?5步教你快速上手
第48篇-timestamp2参数分析【2022-08-01】
什么是 commonjs2
【C语言】夏日一题 —— 如何判断素数?
0801~ Interview questions
3 ways for OpenFeign to set headers
FreeRTOS experiment -- delete task
嵌入式系统驱动初级【2】——字符设备驱动基础上_基础框架
RISC-V instruction format and 6 basic integer instructions








