当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- MathType中如何编辑求和公式
- Git + -- Code hosting in the history of version management
- How to page query after the 10 billion level data sub table?
- Configure the NZ date picker time selection component of ng zerro
- 如何运用二分查找算法
- How to edit summation formula in MathType
- Leetcode 48 rotating image
- openocd+jlink_picture
- Hot update scheme of Chrome extension program: 2. Based on double cache update function module
- 40 tips for life that may be useful
猜你喜欢

PHP - cURL复制粘贴性接入短信验证码示例

【涂鸦物联网足迹】涂鸦云平台接口说明

Configure the NZ date picker time selection component of ng zerro

【STM32H7】第6章 ThreadX GUIX上手之STM32H7 DMA2D加速

Gesture switch background, let live with goods more immersive

几乎刷完了力扣所有的链表题,我发现了这些东西。。。

AQS源码深入分析之条件队列

The database executes truncate table cm_ CHECK_ ITEM_ How does his recover

A great guide to curl

DCL单例模式中的缺陷及单例模式的其他实现
随机推荐
RabbitMQ安装
A practical chrome Gadget: xtrace
【STM32F429】第6章 ThreadX GUIX上手之STM32F429 DMA2D加速
【STM32H7】第6章 ThreadX GUIX上手之STM32H7 DMA2D加速
C#控制台调用FFMPEG推MP4视频文件至流媒体开源服务平台EasyDarwin过程
R8 编译器: 为 Kotlin 库和应用 '瘦身'
DCL单例模式中的缺陷及单例模式的其他实现
iOS下带小数点的数字键盘
Hot update scheme of Chrome extension program: 2. Based on double cache update function module
What if the Mac can't connect to the app store and prompts you to connect to the network?
day83:luffy:添加购物车&导航栏购物车数字显示&购物车页面展示
Abbyy finereader 15 added edit table cell function
From master of Engineering Physics of Tsinghua University to open source entrepreneur of cloud computing
GPS对时系统(网络对时仪器)应用电子政务系统
高性能库DPDK精简理解
Introduction to zero base little white Python
Openocd-jtag debugging
40 tips for life that may be useful
Mac无法连接到App Store并提示需要连接网络怎么办?
PHP - cURL复制粘贴性接入短信验证码示例