当前位置:网站首页>【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>
);
};
边栏推荐
- Detailed explanation of network flow (what information can the flow network diagram generally reflect)
- How to use the database like tap water?|Tencent Cloud Database TDSQL-C
- Redis全部
- Openlayers 快速上手教程
- 自定义mvc框架复习
- Singleton pattern of seven kinds of writing, you know?
- String concatenation in SQL
- ThinkPHP 5.1反序列化分析和poc
- SQL Server 2014安装教程(保姆级图解教程)
- Cannot determine loading status from target frame detached when selenium chrome driver is running
猜你喜欢
随机推荐
GCC版本升级到指定版本
Cannot determine loading status from target frame detached when selenium chrome driver is running
Object.entries()
[b01lers2020]Welcome to Earth-1
如何关闭开启硬件加速[通俗易懂]
Data Lake (2): What is Hudi
Singleton pattern of seven kinds of writing, you know?
photo-sphere-viewer中文文档
鲁大师7月新机性能/流畅榜:性能跑分突破123万!
Basic operations of openGauss database (super detailed)
.Net 5.0快速上手 Redis
使用Amazon SageMaker 构建基于自然语言处理的文本摘要应用
Import and export data of SQL Server database
Seata Distributed Transaction
Introduction to Graph Neural Networks (GNN) "Recommended Collection"
Oracle update error operation single table rollback
uniapp/小程序 onload方法每次打开页面都执行解读
LeetCode_139_word split
Software component analysis: 5 major capabilities to protect software supply chain security
pytorch model to tensorflow model