@@ -14,6 +14,7 @@ import {
14
14
} from '@angular/core' ;
15
15
import { IGX_TIME_PICKER_COMPONENT , IgxTimePickerBase } from './time-picker.common' ;
16
16
import { InteractionMode } from '../core/enums' ;
17
+ import { DatePickerUtil } from '../date-picker/date-picker.utils' ;
17
18
18
19
/** @hidden */
19
20
@Directive ( {
@@ -268,7 +269,7 @@ export class IgxHourItemDirective {
268
269
269
270
@HostBinding ( 'class.igx-time-picker__item--disabled' )
270
271
get applyDisabledStyleForHours ( ) : boolean {
271
- if ( this . minValueDate === undefined || this . maxValueDate === undefined ) {
272
+ if ( ! this . minValueDate || ! this . maxValueDate ) {
272
273
return false ;
273
274
}
274
275
let hour = parseInt ( this . value , 10 ) ;
@@ -277,7 +278,7 @@ export class IgxHourItemDirective {
277
278
}
278
279
const date = new Date ( this . minValueDate ) ;
279
280
date . setHours ( hour ) ;
280
- return ! ( date <= this . maxValueDate && date >= this . minValueDate ) ;
281
+ return ( DatePickerUtil . lessThanMinValue ( date , this . minValueDate ) || DatePickerUtil . greaterThanMaxValue ( date , this . maxValueDate ) ) ;
281
282
}
282
283
283
284
get isSelectedHour ( ) : boolean {
@@ -336,7 +337,7 @@ export class IgxMinuteItemDirective {
336
337
337
338
@HostBinding ( 'class.igx-time-picker__item--disabled' )
338
339
get applyDisabledStyleForMinutes ( ) : boolean {
339
- if ( this . minValueDate === undefined || this . maxValueDate === undefined ) {
340
+ if ( ! this . minValueDate || ! this . maxValueDate ) {
340
341
return false ;
341
342
}
342
343
const minute = parseInt ( this . value , 10 ) ;
@@ -347,7 +348,7 @@ export class IgxMinuteItemDirective {
347
348
const date = new Date ( this . minValueDate ) ;
348
349
date . setHours ( hour ) ;
349
350
date . setMinutes ( minute ) ;
350
- return ! ( date <= this . maxValueDate && date >= this . minValueDate ) ;
351
+ return ( DatePickerUtil . lessThanMinValue ( date , this . minValueDate ) || DatePickerUtil . greaterThanMaxValue ( date , this . maxValueDate ) ) ;
351
352
}
352
353
353
354
get isSelectedMinute ( ) : boolean {
@@ -409,7 +410,7 @@ export class IgxSecondsItemDirective {
409
410
410
411
@HostBinding ( 'class.igx-time-picker__item--disabled' )
411
412
get applyDisabledStyleForSeconds ( ) : boolean {
412
- if ( this . minValueDate === undefined || this . maxValueDate === undefined ) {
413
+ if ( ! this . minValueDate || ! this . maxValueDate ) {
413
414
return false ;
414
415
}
415
416
const minute = parseInt ( this . selectedMinute , 10 ) ;
@@ -422,7 +423,7 @@ export class IgxSecondsItemDirective {
422
423
date . setHours ( hour ) ;
423
424
date . setMinutes ( minute ) ;
424
425
date . setSeconds ( second ) ;
425
- return ! ( date <= this . maxValueDate && date >= this . minValueDate ) ;
426
+ return ( DatePickerUtil . lessThanMinValue ( date , this . minValueDate ) || DatePickerUtil . greaterThanMaxValue ( date , this . maxValueDate ) ) ;
426
427
}
427
428
428
429
get isSelectedSeconds ( ) : boolean {
@@ -484,7 +485,7 @@ export class IgxAmPmItemDirective {
484
485
485
486
@HostBinding ( 'class.igx-time-picker__item--disabled' )
486
487
get applyDisabledStyleForAmPm ( ) : boolean {
487
- if ( this . minValueDate === undefined || this . maxValueDate === undefined ) {
488
+ if ( ! this . minValueDate || ! this . maxValueDate ) {
488
489
return false ;
489
490
}
490
491
const minute = parseInt ( this . selectedMinute , 10 ) ;
@@ -498,7 +499,7 @@ export class IgxAmPmItemDirective {
498
499
date . setHours ( hour ) ;
499
500
date . setMinutes ( minute ) ;
500
501
date . setSeconds ( second ) ;
501
- return ! ( date <= this . maxValueDate && date >= this . minValueDate ) ;
502
+ return ( DatePickerUtil . lessThanMinValue ( date , this . minValueDate ) || DatePickerUtil . greaterThanMaxValue ( date , this . maxValueDate ) ) ;
502
503
}
503
504
504
505
get isSelectedAmPm ( ) : boolean {
0 commit comments