{"record":{"id":"9493111664094ab8","repo":"angular/components","slug":"matdatepicker-no-provider-found-for-dateadapter-949311","errorCode":null,"errorMessage":"MatDatepicker: No provider found for DateAdapter. 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 DateAdapter\\. 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/datepicker-input-base.ts","lineNumber":251,"sourceCode":"  /** Assigns a value to the input's model. */\n  protected abstract _assignValueToModel(model: D | null): void;\n\n  /** Converts a value from the model into a native value for the input. */\n  protected abstract _getValueFromModel(modelValue: S): D | null;\n\n  /** Combined form control validator for this input. */\n  protected abstract _validator: ValidatorFn | null;\n\n  /** Predicate that determines whether the input should handle a particular change event. */\n  protected abstract _shouldHandleChangeEvent(event: DateSelectionModelChange<S>): boolean;\n\n  /** Whether the last value set on the input was valid. */\n  protected _lastValueValid = false;\n\n  constructor() {\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    // Update the displayed date when the locale changes.\n    this._localeSubscription = this._dateAdapter.localeChanges.subscribe(() => {\n      this._assignValueProgrammatically(this.value, true);\n    });\n  }\n\n  ngAfterViewInit() {\n    this._isInitialized = true;\n  }\n\n  ngOnChanges(changes: SimpleChanges<this>) {\n    if (dateInputsHaveChanged(changes, this._dateAdapter)) {","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/angular/components/blob/0411926e7d8ae06b32236ec1048a888cfad5abf2/src/material/datepicker/datepicker-input-base.ts#L233-L269","documentation":"MatDatepickerInput (base for single and range inputs) injects both DateAdapter and MAT_DATE_FORMATS. Without them it cannot parse user text into dates, so its constructor throws in dev mode — same family as errors 220/221/222 but raised from the input component.","triggerScenarios":"Rendering an input with [matDatepicker] (or [matStartDate]/[matEndDate]) without a DateAdapter provider in the injector tree.","commonSituations":"Standalone apps that added MatDatepickerModule/MatFormFieldModule but never provideNativeDateAdapter; per-component provider scoped only to the component hosting the toggle, not the input; migration from NgModule-based setup where NativeDateModule re-exports were removed.","solutions":["Add provideNativeDateAdapter() to app.config.ts (or the component's) providers.","Use provideMomentDateAdapter()/provideDateFnsAdapter()/provideLuxonDateAdapter() if your form model uses those date types.","If formats are missing too (see error 221), prefer the combined provide*DateAdapter functions over manual DateAdapter-only providers."],"exampleFix":"// before\nbootstrapApplication(AppComponent, { providers: [] });\n\n// after\nbootstrapApplication(AppComponent, {\n  providers: [provideNativeDateAdapter()]\n});","handlingStrategy":"validation","validationCode":"import { Injector, inject } from '@angular/core';\nimport { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core';\nconst inj = inject(Injector);\nif (!inj.get(DateAdapter, null)) throw new Error('MatDatepickerInput: missing DateAdapter provider');\nif (!inj.get(MAT_DATE_FORMATS, null)) throw new Error('MatDatepickerInput: missing MAT_DATE_FORMATS provider');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bootstrap apps with provideNativeDateAdapter() (or matching library adapter) by default.","Add the adapter to TestBed providers in every component test touching datepicker inputs.","During migrations, grep for MatDatepickerModule imports and confirm an adapter provider exists."],"tags":["angular-material","datepicker","dependency-injection","missing-provider"],"backgroundTag":"missing-di-provider","analyzedSha":"0411926e7d8ae06b32236ec1048a888cfad5abf2","analyzedAt":"2026-08-31T11:58:23.400Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}