Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Angular] text-mask not change input on Safari #1052

Open
dwtachospeed opened this issue Jun 8, 2022 · 0 comments
Open

[Angular] text-mask not change input on Safari #1052

dwtachospeed opened this issue Jun 8, 2022 · 0 comments

Comments

@dwtachospeed
Copy link

On Safari (macOS), angular2-text-mask not change input with Angular Material Datepicker.
On Chrome, Firefox, Opera works correctly.

On Safari input called onBlur() function, but not toDate() function.

HTML file:

          <mat-form-field appearance="outline">
            <mat-label>Date from</mat-label>
            <input type="hidden" [matDatepicker]="dateFromPicker" [min]="minDate" [max]="maxDate" formControlName="dateFrom"
              placeholder="Date from" />
            <input matInput type="text" [textMask]="DATEPICKER_MASK" [ngModel]="form.get('dateFrom')?.value | date : form.get('dateFrom')?.value !== '' ? 'dd-MM-yyyy' : ''"
              [ngModelOptions]="{standalone: true}" (blur)="onBlur('dateFrom')" (change)="toDate('dateFrom', $event.target.value);" />
            <mat-datepicker-toggle matSuffix [for]="dateFromPicker">
              <ic-icon [icon]="calendarMonth" inline="true" size="18px" matDatepickerToggleIcon></ic-icon>
            </mat-datepicker-toggle>
            <mat-datepicker #dateFromPicker></mat-datepicker>
          </mat-form-field>

TypeScript file:

  DATEPICKER_MASK = {
    guide: true,
    showMask: true,
    mask: [/\d/, /\d/, '-', /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/],
  };

Angular: 12.1.5
angular2-text-mask: 9.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant