angular / angular/components

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

Đang mở
#28,041 2 bình luận 2 reaction 0 người được giao Xem trên GitHub
area: material/datepicker P3
Ngôn ngữ chính
TypeScript
Star
25k
Fork
6.8k
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
91

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Bắt đầu bằng cách chạy bản tái hiện StackBlitz được liên kết từ src/main.ts và làm theo thiết lập standalone dialog được mô tả trong issue. Xác nhận lỗi lookup của MatDateFnsAdapter khi mở datepicker, sau đó xác minh rằng datepicker mở mà không có lỗi trong console, đồng thời giữ import của adapter ở phạm vi cục bộ của component cần nó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
angular, typescript
Lĩnh vực
frontend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.