{"record":{"id":"8a5a1760a2185864","repo":"angular/components","slug":"matdatepicker-no-provider-found-for-mat-date-form-8a5a17","errorCode":null,"errorMessage":"MatDatepicker: No provider found for MAT_DATE_FORMATS. You must add one of the following to your app config: provideNativeDateAdapter, provideDateFnsAdapter, provideLuxonDateAdapter, provideMomentDateAdapter, or provide a custom implementation.","messagePattern":"MatDatepicker: No provider found for MAT_DATE_FORMATS\\. You must add one of the following to your app config: provideNativeDateAdapter, provideDateFnsAdapter, provideLuxonDateAdapter, provideMomentDateAdapter, or provide a custom implementation\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/material/datepicker/month-view.ts","lineNumber":227,"sourceCode":"  _previewEnd = signal<number | null>(null);\n\n  /** Whether the user is currently selecting a range of dates. */\n  _isRange = signal(false);\n\n  /** The date of the month that today falls on. Null if today is in another month. */\n  _todayDate = signal<number | null>(null);\n\n  /** The names of the weekdays. */\n  _weekdays = signal<{long: string; narrow: string; id: number}[]>([]);\n\n  constructor() {\n    inject(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);\n    if (typeof ngDevMode === 'undefined' || ngDevMode) {\n      if (!this._dateAdapter) {\n        throw createMissingDateImplError('DateAdapter');\n      }\n      if (!this._dateFormats) {\n        throw createMissingDateImplError('MAT_DATE_FORMATS');\n      }\n    }\n\n    this._activeDate = this._dateAdapter.today();\n  }\n\n  ngAfterContentInit() {\n    this._rerenderSubscription = this._dateAdapter.localeChanges\n      .pipe(startWith(null))\n      .subscribe(() => this._init());\n  }\n\n  ngOnChanges(changes: SimpleChanges<this>) {\n    const comparisonChange = changes['comparisonStart'] || changes['comparisonEnd'];\n\n    if (comparisonChange && !comparisonChange.firstChange) {\n      this._setRanges(this.selected);\n    }","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/material/datepicker/month-view.ts#L209-L245","documentation":"MatMonthView requires the MAT_DATE_FORMATS token to format weekday/month labels. This dev-mode guard throws when the token has no provider. Typically the app also lacks a DateAdapter provider, since the recommended adapters register both tokens together.","triggerScenarios":"Rendering the month view (via mat-datepicker/mat-calendar) with a DateAdapter provided but no MAT_DATE_FORMATS provider — e.g. a custom DateAdapter supplied without MAT_DATE_FORMATS.","commonSituations":"Custom adapter implementations registered manually via {provide: DateAdapter, useClass: ...} without the matching formats; partial provider sets copied from old examples; overriding formats with useValue but removing the adapter provider.","solutions":["Add provideNativeDateAdapter() (which registers both DateAdapter and MAT_DATE_FORMATS) to app config providers","If a custom DateAdapter is needed, also provide MAT_DATE_FORMATS: {provide: MAT_DATE_FORMATS, useValue: MY_DATE_FORMATS}","Prefer the official provider functions (provideDateFnsAdapter etc.) which wire both tokens atomically"],"exampleFix":"// before\n{provide: DateAdapter, useClass: MyDateAdapter}\n// after\n{provide: DateAdapter, useClass: MyDateAdapter},\n{provide: MAT_DATE_FORMATS, useValue: MY_NATIVE_DATE_FORMATS}","handlingStrategy":"validation","validationCode":"const formats = inject(MAT_DATE_FORMATS, {optional: true});\nconst adapter = inject(DateAdapter, {optional: true});\nif (!adapter || !formats) throw new Error('Datepicker providers incomplete');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never register DateAdapter manually without also providing MAT_DATE_FORMATS","Prefer provideNativeDateAdapter() which supplies both tokens","Grep your providers for `provide: DateAdapter` and verify a MAT_DATE_FORMATS sibling exists"],"tags":["angular","material","datepicker","dependency-injection","configuration"],"backgroundTag":"missing-dateadapter-provider","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}