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

min and max are colliding with Mat date component validations #19

Open
mhmo91 opened this issue Feb 3, 2019 · 0 comments
Open

min and max are colliding with Mat date component validations #19

mhmo91 opened this issue Feb 3, 2019 · 0 comments
Assignees
Labels

Comments

@mhmo91
Copy link

mhmo91 commented Feb 3, 2019

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
@rsaenen rsaenen added the bug label Feb 4, 2019
@rsaenen rsaenen self-assigned this Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants