当前位置:网站首页>【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>
);
};
边栏推荐
猜你喜欢
随机推荐
路由-嵌套路由
Name conventions in FreeRTOS
pytorch model to tensorflow model
php——三篇夯实根基第一篇
Good shooting js game source code
自动生成代码器推荐-code-gen
国产 GPU 创业潮 喧嚣下的资本游戏
ssm access database data error
qt 编译报错 No rule to make target
Article 48 - Analysis of timestamp2 parameters【2022-08-01】
SQL Server database generation and execution of SQL scripts
scrapy框架初识1
Oracle update error operation single table rollback
Introduction to Graph Neural Networks (GNN) "Recommended Collection"
80篇国产数据库实操文档汇总(含TiDB、达梦、openGauss等)
Win11怎么修改关机界面颜色?Win11修改关机界面颜色的方法
RestTemplate use: set request header, request body
单例模式的七种写法,你都知道吗?
冰箱“扩容”的战事,在今夏格外猛烈
Intelligent Image Analysis-Intelligent Home Appliance Image Target Detection Statistical Counting Detection and Recognition-iCREDIT









