bug(material-date-fns-adapter): MatDateFnsAdapter not imported into standalone dialog component
- Dominant language
- TypeScript
- Stars
- 25k
- Forks
- 6.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 91
Description
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
I'm not sure if it is a bug or just how it works atm, but when using a MatDatepicker with MatDateFnsModule it will not find the DateAdapter when using this in a standalone dialog component. (it's working in all other standalone components which are not a dialog).
If I add the MatDateFnsAdapter to the imports of the component which opens the dialog, everything is fine. But with standalone components I usually expect the imports in the component that really needs it.
I prepared a StackBlitz example.
### Reproduction
StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-35ebyd?file=src%2Fmain.ts
Steps to reproduce:
1. Wait for the dev server to load
2. Click "Open Dialog"
3. Click on the calendar icon in the input field
4. See the console log
### Expected Behavior
No error message should appear on the console and the datepicker should open.
### Actual Behavior
Datepicker does not open because of the console error.
### Environment
- Angular: 16.2.11
- CDK/Material: 16.2.11
- Browser(s): Edge, Chrome
Contributor guide
Research direction
Start by running the linked StackBlitz reproduction from src/main.ts and follow the standalone dialog setup described in the issue. Confirm the MatDateFnsAdapter lookup failure when opening the datepicker, then verify that the datepicker opens without a console error while keeping the adapter import local to the component that needs it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100