angular / angular/components

bug(material-date-fns-adapter): MatDateFnsAdapter not imported into standalone dialog component

Ouverte
#28,041 2 commentaires 2 réactions 0 personnes assignées Voir sur GitHub
area: material/datepicker P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par exécuter la reproduction StackBlitz liée depuis src/main.ts et suivez la configuration du dialogue standalone décrite dans l’issue. Confirmez l’échec du lookup de MatDateFnsAdapter lors de l’ouverture du datepicker, puis vérifiez que le datepicker s’ouvre sans erreur dans la console tout en gardant l’import de l’adaptateur local au composant qui en a besoin.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.