core.js:4197 ERROR NullInjectorError: R3InjectorError(AppModule)[DataAdapter -> DataAdapter -> DataAdapter]: NullInjectorError: No provider for DateAdapter! code example

Example 1: no provider for dateadapter unit test

imports: [
    MatDatepickerModule,
    MatNativeDateModule 
  ],
  providers: [  
    MatDatepickerModule,  
  ],

Example 2: 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

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

Tags:

Misc Example