当前位置:网站首页>【typescript】使用antd中RangePicker组件实现时间限制 当前时间的前一年(365天)
【typescript】使用antd中RangePicker组件实现时间限制 当前时间的前一年(365天)
2022-08-02 13:02:00 【Sco_Jing1031】
//先导入组件
import {
DatePicker } from 'antd';
import moment from 'moment';
const {
RangePicker } = DatePicker;
/**操作时间下拉项 */
const renderTimeSelect = () => {
/**可选范围为最近一年 */
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>
);
};
边栏推荐
猜你喜欢
Import and export data of SQL Server database
Data Lake (3): Hudi Concept Terminology
Openlayers 快速上手教程
js semi-circle loading progress animation js special effects
C语言结构体(入门)
Singleton pattern of seven kinds of writing, you know?
Good shooting js game source code
js true 3d histogram plugin
ssm access database data error
Seata分布式事务
随机推荐
LeetCode_377_组合总和Ⅳ
js stopwatch countdown plugin
节省50%成本!京东云重磅发布新一代混合CDN产品
uniapp/小程序 onload方法每次打开页面都执行解读
FreeRTOS实验--删除任务
如何关闭开启硬件加速[通俗易懂]
高效代码静态测试工具Klocwork 2022.2——Portal全新升级、支持RLM
php - the first of three solid foundations
RestTemplate use: set request header, request body
UAC绕过学习-总结
js真3d柱状图插件
Wireless vibrating wire acquisition instrument remote modification method
SQL Server 2019 installation error 0 x80004005 service there is no timely response to the start or control request a detailed solution
国产 GPU 创业潮 喧嚣下的资本游戏
pytorch模型转tensorflow模型
MFC入门教程(深入浅出MFC)
svg气球升起爆炸js特效
0801~ Interview questions
svg balloon rises explosion js special effect
Do you know Dijkstra of graph theory?