当前位置:网站首页>Configure ng
Configure ng
2020-11-09 19:13:00 【Irving the procedural ape】
1、 The official sample nz-date-picker
The effect achieved in the official example cannot meet the requirements of business query , such as : I need to select the start time first , Then when you select the end time, you cannot select the data of the same date , And even if you choose “ At the moment ” when , The corresponding time is not disabled
explain :ng-zerro There is a corresponding implementation , But in the example, it's relatively simple , It's not going to work , This paper only makes its own implementation record 
2、 How to achieve can choose the same time , And disable the time that is not in the selected time range
Such as : Starting time 2020-11-09 12:12:12, The end time needs to be selected 2020-11-09 12:12:12, And less than 2020-11-09 12:12:12 Time to disable
html Realization :
<nz-date-picker [nzDisabledTime]="disabledStartTime" [nzDisabledDate]="disabledStartDate" nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss" [(ngModel)]="startValue" nzPlaceHolder=" Starting time " (ngModelChange)="onStartChange($event)" > </nz-date-picker> <nz-date-picker [nzDisabledTime]="disabledEndTime" [nzDisabledDate]="disabledEndDate" nzShowTime nzFormat="yyyy-MM-dd HH:mm:ss" [(ngModel)]="endValue" nzPlaceHolder=" End time " (ngModelChange)="onEndChange($event)" > </nz-date-picker>
ts Realization :
// Configure the date disabledStartDate = (startValue: Date): boolean => { if (!startValue || !this.endValue) { return false; } // At the same time, you can choose if (startValue.getTime() === this.endValue.getTime()){ return false; } return startValue.getTime() >= this.endValue.getTime();}disabledEndDate = (endValue: Date): boolean => { if (!endValue || !this.startValue) { return false; } if (endValue.getDate() === this.startValue.getDate()) { // Do not disable the same date return false; }else{ // At the same time, you can choose return endValue.getTime() <= this.startValue.getTime(); }}// Disable time disabledStartTime: DisabledTimeFn = (_value: Date, type?: DisabledTimePartial) => { // Set the start time if (!this.endValue){ return null; } if (!_value){ _value = this.endValue; } let disableMinutes = []; let disableS.........
版权声明
本文为[Irving the procedural ape]所创,转载请带上原文链接,感谢
边栏推荐
猜你喜欢

说说 C# 9 新特性的实际运用

EMQ X 在中国建设银行物联网平台中的应用

传统采购模式已变!汽车采购职能该如何创新?

磁阻式随机存储器MRAM基本原理

上云嘉年华,超低价云服务器来袭

Double 11 big second kill, cloud server as low as 0.7 fold

What is the essence of cloud database? Explore the core value of Huawei cloud database

报错 Type interface *** is not known to the MapperRegistry. 的解决方案

JT-day10

CIM平台可视化建设
随机推荐
2020中国电信终端技术与标准论坛上专家解读四大热门产业
Git + -- Code hosting in the history of version management
磁阻式随机存储器MRAM基本原理
Single linked list inversion
The database executes truncate table cm_ CHECK_ ITEM_ How does his recover
如何使用RTSP推流组件EasyPusher将MP4文件推到EasyDarwin开源平台?
手势切换背景,让直播带货更加身临其境
Container technology (3) mirror summary [16]
高性能库DPDK精简理解
What is the essence of cloud database? Explore the core value of Huawei cloud database
How to realize the authority route and authority menu of background management system
双十一大秒杀,云服务器低至 0.7 折
From master of Engineering Physics of Tsinghua University to open source entrepreneur of cloud computing
openocd+jlink_picture
又一道比较运算符相关的面试题让我明白基础很重要
How to edit summation formula in MathType
R8 compiler: tailoring kotlin libraries and Applications
iOS下带小数点的数字键盘
Chrome扩展程序热更新方案:2.基于双缓存更新功能模块
Visualization construction of CIM platform