angular / angular/components

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

Offen
#28,041 2 Kommentare 2 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
area: material/datepicker P3
Vorherrschende Sprache
TypeScript
Sterne
25k
Forks
6.8k
Ø Merge
1 T. 8 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Starten Sie zunächst die verknüpfte StackBlitz-Reproduktion aus src/main.ts und folgen Sie der im Issue beschriebenen Einrichtung des Standalone-Dialogs. Bestätigen Sie den MatDateFnsAdapter-Lookup-Fehler beim Öffnen des Datepickers und überprüfen Sie anschließend, dass der Datepicker ohne einen Konsolenfehler geöffnet wird, während der Adapter-Import lokal auf die Komponente beschränkt bleibt, die ihn benötigt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
angular, typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.