angular / angular/components

bug(MatDatePicker): NativeDatePicker not using the correct format initially

Đang mở
#31,107 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
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

When I use the following setup:

```

provideNativeDateAdapter({
parse: {
dateInput: 'DD.MM.YYYY',
},
display: {
dateInput: 'DD.MM.YYYY',
monthYearLabel: 'MMM YYYY',
dateA11yLabel: 'LL',
monthYearA11yLabel: 'MMMM YYYY',
},
}),
{
provide: LOCALE_ID,
useValue: 'de-CH'
},
```

the DatePicker will show the date in the wrong format: "13.5.2025" instead of "13.05.2025". Why are the format options ignored?

### Reproduction

StackBlitz link:
Steps to reproduce:
1.
2.

### Expected Behavior

Date is formatted as "13.05.2025".

### Actual Behavior

Date is formatted as "13.5.2025".

### Environment

- Angular: 19.1.4
- CDK/Material: 19.1.5
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 11

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

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

Hướng nghiên cứu

Bắt đầu với NativeDatePicker và cấu hình provideNativeDateAdapter được hiển thị trong issue, sử dụng locale de-CH và định dạng dateInput được cung cấp. Tái hiện hiển thị ban đầu và theo dõi lý do định dạng đã cấu hình bị bỏ qua; hoàn thành khi picker ban đầu hiển thị ngày là "13.05.2025".

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ó
3/5
Thời gian dự kiến
1-2 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
35/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.