当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- 非常值得一看的 Curl 用法指南
- 都要2021年了,现代C++有什么值得我们学习的?
- 【涂鸦物联网足迹】涂鸦云平台接口说明
- Building Hadoop environment based on pseudo distributed under centos7
- How to realize the authority route and authority menu of background management system
- 第三阶段 Day20 购物车模块实现 添加拦截器 添加用户权限校检 实现订单模块
- Hot update scheme of Chrome extension program: 2. Based on double cache update function module
- 如何用代码上传头像,并添加自己的版权信息?
- 老旧系统重构技巧,轻松搞定遗留代码
- 分库分表的 9种分布式主键ID 生成方案,挺全乎的
猜你喜欢

开源项目,私活利器,快速开发

骚操作!嵌套 JSON 秒变 Dataframe!
![[最佳实践]了解 Eolinker 如何助力远程办公](/img/3b/00bc81122d330c9d59909994e61027.jpg)
[最佳实践]了解 Eolinker 如何助力远程办公

Revealing the logic of moving path selection in Summoner Canyon?

Visualization construction of CIM platform

How to use RTSP streaming component easypusher to push MP4 files to easydarwin open source platform?

More than 60 technical executives gathered in Songshan Lake, and the first phase of Huawei cloud core partner developer training camp was successfully concluded

Mac无法连接到App Store并提示需要连接网络怎么办?

Hand in hand to teach you to use container service tke cluster audit troubleshooting

CIM平台可视化建设
随机推荐
AQS源码深入分析之条件队列
From master of Engineering Physics of Tsinghua University to open source entrepreneur of cloud computing
VsCode之Markdown插件
手势切换背景,让直播带货更加身临其境
What is the essence of cloud database? Explore the core value of Huawei cloud database
Gesture switch background, let live with goods more immersive
[stm32f429] Chapter 6: stm32f429 dma2d acceleration of ThreadX guix
菜鸟福音,28本书籍循序渐进让你成为大牛!(附学习大纲一份)
C#控制台调用FFMPEG推MP4视频文件至流媒体开源服务平台EasyDarwin过程
LeetCode 48 旋转图像
海外仓见证中欧跨境电商蓬勃发展
财务管理系统如何帮助企业实现财务自动化管理?
说说 C# 9 新特性的实际运用
SQL Server附加数据库拒绝访问解决方法汇总
第三阶段 Day20 购物车模块实现 添加拦截器 添加用户权限校检 实现订单模块
GPS对时系统(网络对时仪器)应用电子政务系统
Simple implementation of activity workflow interactive demo
RBAC of kubernetes authority management (1)
Four solutions of Android soft keyboard occlusion
容器技术(三)镜像小结【16】