angular / angular/components

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

オープン
#28,041 コメント 2 件 リアクション 2 件 担当者 0 名 GitHub で見る
area: material/datepicker P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず src/main.ts からリンクされている StackBlitz の再現を実行し、issue に記載されている standalone dialog のセットアップに従います。datepicker を開いたときに MatDateFnsAdapter の lookup に失敗することを確認し、その後、必要とするコンポーネント内に adapter の import をローカルに保持したまま、コンソールエラーなしで datepicker が開くことを検証します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
frontend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。