当前位置:网站首页>[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>
);
};
边栏推荐
猜你喜欢
随机推荐
汉源高科千兆12光12电管理型工业以太网交换机 12千兆光12千兆电口宽温环网交换机
js true 3d histogram plugin
路由-嵌套路由
鲁大师7月新机性能/流畅榜:性能跑分突破123万!
js stopwatch countdown plugin
Seata分布式事务
分享一个Chrome控制台数据获取的例子
How to use the database like tap water?|Tencent Cloud Database TDSQL-C
Redis all
消除气泡解救蘑菇h5小游戏源码
Oracle update error operation single table rollback
【typescript】使用antd中RangePicker组件实现时间限制 当前时间的前一年(365天)
C语言结构体(入门)
[b01lers2020]Welcome to Earth-1
瀑布流式布局怎么实现(什么是瀑布流布局)
LeetCode_377_Combination Sum IV
图文短视频自媒体怎么创作?如何让点击量达到10W?
js真3d柱状图插件
【C语言】夏日一题 —— 求最大公约数和最小公倍数
WeChat applet getPhoneNumber interface code=40013