ngx-custom-validators
ngx-custom-validators copied to clipboard
min and max are colliding with Mat date component validations
When this module is imported in a project that is used with Mat components, a problem happens with the material date component as it uses min and max validations
<mat-form-field class="col">
<input matInput [matDatepicker]="from" name="fromDate" [placeholder]="fromLabel" #fromDate="ngModel" [(ngModel)]="dateFrom"
(dateChange)="dateFromChanged()" [required]="required" [min]="minDateFrom" [max]="maxDateFrom" [disabled]="readonly"
(click)="from.open()" autocomplete="off">
<mat-datepicker-toggle matSuffix [for]="from"></mat-datepicker-toggle>
<mat-datepicker #from></mat-datepicker>
<form-validation [name]="fromDate"></form-validation>
</mat-form-field>
when you use moment as date picker provider in the component
providers: [
{ provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] },
{ provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS },
],
Environment information
- OS:
- Angular Version: 7.2.1
- Typescript version: 3.2.4
- npm version: 6.6.0
- Node Version: 8.11.2