Error: "MatDatepicker: No provider found for DateAdapter

Asked on June 25, 2020
I am creating Angular Material Datepicker .

  <mat-label>Select Date</mat-label>
  <input matInput [matDatepicker]="dt">
  <mat-datepicker-toggle matSuffix [for]="dt"></mat-datepicker-toggle>
  <mat-datepicker #dt></mat-datepicker>

But getting following error.

Error: "MatDatepicker: No provider found for DateAdapter. You must import one of the following modules at your application root: MatNativeDateModule, MatMomentDateModule, or provide a custom implementation."

Replied on June 25, 2020
You are missing

import { MatNativeDateModule } from '@angular/material/core';

For Datepicker, make sure you have following settings.


import { MatInputModule } from '@angular/material/input';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';

  imports: [
export class AppModule { }

Write Answer

©2024 | Privacy Policy | Contact Us