当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Git老鸟查询手册
- Another comparison operator related interview question let me understand that the foundation is very important
- 老旧系统重构技巧,轻松搞定遗留代码
- In the third stage, the day20 Shopping Cart module is added, the interceptor is added, the user authority is checked, and the order module is realized
- 手势切换背景,让直播带货更加身临其境
- JT-day10
- YoMo Codec - Y3的性能评测报告
- 【科创人】Rancher江鹏:从清华工程物理学硕士到云计算开源创业者
- How to edit summation formula in MathType
- RabbitMQ安装
猜你喜欢

RabbitMQ安装
![[stm32f429] Chapter 6: stm32f429 dma2d acceleration of ThreadX guix](/img/06/94a66b6072d24e3d69b3a54ab77d28.jpg)
[stm32f429] Chapter 6: stm32f429 dma2d acceleration of ThreadX guix

SQL Server附加数据库拒绝访问解决方法汇总

openocd+jlink_picture

如何用代码上传头像,并添加自己的版权信息?

Four solutions of Android soft keyboard occlusion

Visualization construction of CIM platform

超简单集成华为系统完整性检测,搞定设备安全防护

你了解你的服务器吗、你知道服务器的有哪些内幕吗

Hand in hand to teach you to use container service tke cluster audit troubleshooting
随机推荐
[graffiti Internet of things footprint] graffiti cloud platform interface description
High performance library dpdk concise understanding
老旧系统重构技巧,轻松搞定遗留代码
Openocd-jtag debugging
高性能库DPDK精简理解
一个实用的Chrome小工具:xTrace
小程序调用原生onShareAppMessage分享,imageUrl参数是mp4格式怎么办
Double 11 big second kill, cloud server as low as 0.7 fold
【云小课】版本管理发展史之Git+——代码托管
数据库执行truncate table CM_CHECK_ITEM_HIS怎么恢复
How the API gateway carries the API economic ecological chain
YoMo Codec - Y3的性能评测报告
你了解你的服务器吗、你知道服务器的有哪些内幕吗
浅谈API网关(API Gateway)如何承载API经济生态链
How the API gateway carries the API economic ecological chain
What is the essence of cloud database? Explore the core value of Huawei cloud database
Markdown plug-in of vscode
A great guide to curl
【科创人】Rancher江鹏:从清华工程物理学硕士到云计算开源创业者
[最佳实践]了解 Eolinker 如何助力远程办公