Skip to content

Commit f5f433b

Browse files
committed
fix(time-picker): adding logic when mix/maxValues are not used.|#3978
1 parent 203d775 commit f5f433b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

projects/igniteui-angular/src/lib/time-picker/time-picker.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,9 @@ export class IgxTimePickerComponent implements
12731273
}
12741274

12751275
public convertMinMaxValue(value: string): Date {
1276+
if (value == null) {
1277+
return;
1278+
} else {
12761279
const date = this.value ? new Date(this.value) : this._dateFromModel ? new Date(this._dateFromModel) : new Date();
12771280
const sections = value.split(/[\s:]+/);
12781281
let hour, minutes, seconds, amPM;
@@ -1313,6 +1316,7 @@ export class IgxTimePickerComponent implements
13131316

13141317
return date;
13151318
}
1319+
}
13161320

13171321
private _isValueValid(value: Date): boolean {
13181322
if (this.maxValue && value > this.convertMinMaxValue(this.maxValue)) {

projects/igniteui-angular/src/lib/time-picker/time-picker.directives.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,9 @@ export class IgxHourItemDirective {
268268

269269
@HostBinding('class.igx-time-picker__item--disabled')
270270
get applyDisabledStyleForHours(): boolean {
271+
if (this.minValueDate === undefined || this.maxValueDate === undefined) {
272+
return false;
273+
}
271274
let hour = parseInt(this.value);
272275
if (this.selectedAmPm === 'PM') {
273276
hour += 12;
@@ -333,6 +336,9 @@ export class IgxMinuteItemDirective {
333336

334337
@HostBinding('class.igx-time-picker__item--disabled')
335338
get applyDisabledStyleForMinutes(): boolean {
339+
if (this.minValueDate === undefined || this.maxValueDate === undefined) {
340+
return false;
341+
}
336342
const minute = parseInt(this.value);
337343
let hour = parseInt(this.selectedHour);
338344
if (this.selectedAmPm === 'PM') {
@@ -403,6 +409,9 @@ export class IgxSecondsItemDirective {
403409

404410
@HostBinding('class.igx-time-picker__item--disabled')
405411
get applyDisabledStyleForSeconds(): boolean {
412+
if (this.minValueDate === undefined || this.maxValueDate === undefined) {
413+
return false;
414+
}
406415
const minute = parseInt(this.selectedMinute);
407416
let hour = parseInt(this.selectedHour);
408417
const second = parseInt(this.value);
@@ -475,6 +484,9 @@ export class IgxAmPmItemDirective {
475484

476485
@HostBinding('class.igx-time-picker__item--disabled')
477486
get applyDisabledStyleForAmPm(): boolean {
487+
if (this.minValueDate === undefined || this.maxValueDate === undefined) {
488+
return false;
489+
}
478490
const minute = parseInt(this.selectedMinute);
479491
let hour = parseInt(this.selectedHour);
480492
const second = parseInt(this.selectedSecond);

0 commit comments

Comments
 (0)