Skip to content

Commit ef058be

Browse files
committed
refactor(time-picker): addressing comments #6482
1 parent 9a95535 commit ef058be

File tree

6 files changed

+121
-161
lines changed

6 files changed

+121
-161
lines changed

Diff for: projects/igniteui-angular/src/lib/directives/date-time-editor/date-time-editor.directive.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
368368
return { value: true };
369369
}
370370

371-
let errors;
371+
let errors = {};
372372
const valueDate = DateTimeUtil.isValidDate(control.value) ? control.value : this.parseDate(control.value);
373373
const minValueDate = DateTimeUtil.isValidDate(this.minValue) ? this.minValue : this.parseDate(this.minValue);
374374
const maxValueDate = DateTimeUtil.isValidDate(this.maxValue) ? this.maxValue : this.parseDate(this.maxValue);
@@ -555,7 +555,7 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
555555
return false;
556556
}
557557

558-
let errors;
558+
let errors = {};
559559
const minValueDate = DateTimeUtil.isValidDate(this.minValue) ? this.minValue : this.parseDate(this.minValue);
560560
const maxValueDate = DateTimeUtil.isValidDate(this.maxValue) ? this.maxValue : this.parseDate(this.maxValue);
561561
if (minValueDate || maxValueDate) {

Diff for: projects/igniteui-angular/src/lib/time-picker/time-picker.component.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
[displayFormat]="this.displayFormat" [igxTextSelection]="this.isDropdown" role="combobox" aria-haspopup="dialog"
77
[attr.aria-expanded]="!this.toggleDirective.collapsed" [attr.aria-labelledby]="this.label?.id" />
88

9+
<igx-prefix *ngIf="!this.toggleComponents.length" (click)="this.toggle()">
10+
<igx-icon fontSet="material">access_time</igx-icon>
11+
</igx-prefix>
12+
913
<ng-container ngProjectAs="[igxLabel]">
1014
<ng-content select="[igxLabel]"></ng-content>
1115
</ng-container>
@@ -19,10 +23,6 @@
1923
<ng-content select="igx-hint,[igxHint]"></ng-content>
2024
</ng-container>
2125

22-
<igx-prefix *ngIf="!this.toggleComponents.length" (click)="this.toggle()">
23-
<igx-icon fontSet="material">access_time</igx-icon>
24-
</igx-prefix>
25-
2626
<igx-suffix *ngIf="this.showClearButton" igxRipple (click)="this.clear()">
2727
<igx-icon fontSet="material">clear</igx-icon>
2828
</igx-suffix>

Diff for: projects/igniteui-angular/src/lib/time-picker/time-picker.component.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ describe('IgxTimePicker', () => {
601601
it('should select minValue when value does not match dropdown values', fakeAsync(() => {
602602
fixture.componentInstance.minValue = new Date(2021, 24, 2, 9, 0, 0);
603603
fixture.componentInstance.maxValue = new Date(2021, 24, 2, 16, 0, 0);
604-
timePicker.itemsDelta = {hour:2, minute: 15, second: 30}
604+
timePicker.itemsDelta = {hour:2, minute: 15, second: 30};
605605
fixture.detectChanges();
606606

607607
timePicker.open();
@@ -621,7 +621,7 @@ describe('IgxTimePicker', () => {
621621
it('should select minValue when value is outside the min/max range', fakeAsync(() => {
622622
fixture.componentInstance.minValue = new Date(2021, 24, 2, 13, 0, 0);
623623
fixture.componentInstance.maxValue = new Date(2021, 24, 2, 19, 0, 0);
624-
timePicker.itemsDelta = {hour:2, minute: 15, second: 30}
624+
timePicker.itemsDelta = {hour:2, minute: 15, second: 30};
625625
fixture.detectChanges();
626626

627627
timePicker.open();

0 commit comments

Comments
 (0)