当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Hand in hand to teach you to use container service tke cluster audit troubleshooting
- OpenOCD-JTAG调试
- How to implement a simple student management system with C + +
- How to page query after the 10 billion level data sub table?
- Hand in hand to teach you to use container service tke cluster audit troubleshooting
- Container technology (3) mirror summary [16]
- 如何用代码上传头像,并添加自己的版权信息?
- openocd+jlink_picture
- Mac无法连接到App Store并提示需要连接网络怎么办?
- [stm32f429] Chapter 6: stm32f429 dma2d acceleration of ThreadX guix
猜你喜欢
AQS源码深入分析之条件队列
Almost finished all the list titles, I found these things...
Rookie gospel, 28 books step by step to make you a big bull! (a copy of learning syllabus attached)
Numeric keyboard with decimal point in IOS
How to edit summation formula in MathType
[最佳实践]了解 Eolinker 如何助力远程办公
【STM32F429】第6章 ThreadX GUIX上手之STM32F429 DMA2D加速
Double 11 big second kill, cloud server as low as 0.7 fold
浅谈API网关(API Gateway)如何承载API经济生态链
[最佳实践]了解 Eolinker 如何助力远程办公
随机推荐
How to realize the authority route and authority menu of background management system
[最佳实践]了解 Eolinker 如何助力远程办公
Git老鸟查询手册
Mac无法连接到App Store并提示需要连接网络怎么办?
揭秘在召唤师峡谷中移动路径选择逻辑?
Hand in hand to teach you to use container service tke cluster audit troubleshooting
百亿级数据分表后怎么分页查询?
Activity工作流交互demo简单实现
C#控制台调用FFMPEG推MP4视频文件至流媒体开源服务平台EasyDarwin过程
openocd+jlink_picture
【科创人】Rancher江鹏:从清华工程物理学硕士到云计算开源创业者
开源项目,私活利器,快速开发
The basic principle of MRAM
报错 Type interface *** is not known to the MapperRegistry. 的解决方案
Hand in hand to teach you to use container service tke cluster audit troubleshooting
【云小课】版本管理发展史之Git+——代码托管
JT-day10
OpenOCD-JTAG调试
配置ng-zerro的nz-date-picker时间选择组件
Introduction to zero base little white Python