Skip to content

Commit 905edfc

Browse files
fix(date-editor): don't apply mask if readonly, displayValuePipe
1 parent 0edc8d8 commit 905edfc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
438438

439439
/** @hidden @internal */
440440
public onFocus(): void {
441+
if (this.nativeElement.readOnly) {
442+
return;
443+
}
441444
this._isFocused = true;
442445
this.onTouchCallback();
443446
this.updateMask();
@@ -453,6 +456,11 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
453456
this.updateMask();
454457
}
455458

459+
// TODO: think of a better way to set displayValuePipe in mask directive
460+
if (this.displayValuePipe) {
461+
return;
462+
}
463+
456464
super.onBlur(value);
457465
}
458466

@@ -468,6 +476,11 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
468476
this.inputValue = '';
469477
return;
470478
}
479+
if (this.displayValuePipe) {
480+
// TODO: remove when formatter func has been deleted
481+
this.inputValue = this.displayValuePipe.transform(this.value);
482+
return;
483+
}
471484
const format = this.displayFormat || this.inputFormat;
472485
if (format) {
473486
this.inputValue = DateTimeUtil.formatDate(this.value, format.replace('tt', 'aa'), this.locale);

0 commit comments

Comments
 (0)