angular / angular/components

bug(DatePicker): Typing a date in "YYYY-MM-DD" format will format the date to "M/D/YYYY" but a day behind

Đang mở
#27,412 8 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: material/datepicker help wanted 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

Typing a date in "YYYY-MM-DD" format will format the date to "M/D/YYYY" but a day behind. This occurs using the control in various modes, including the date range picker.

### Reproduction

Steps to reproduce (can use demo on documentation page):
1. Render date picker with default formatting.
2. Type in the value "2023-07-06"
3. Lose focus of the input field.
4. The date picker changes the value to: "7/5/2023"

### Expected Behavior

I expect to see the date represented in a different format with the same date value.

Value entered: 2023-07-06
Expected result: 7/6/2023

### Actual Behavior

The date in the proper format, but one day behind.

Value entered: 2023-07-06
Actual result: 7/5/2023

### Environment

This bug occurs on the demo page for angular material:
https://material.angular.io/components/datepicker/overview

- Angular: v14+
- CDK/Material: v14+ (probably earlier)
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows

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 bản demo Angular Material datepicker tại material.angular.io và tái hiện việc ô nhập YYYY-MM-DD mất tiêu điểm ở chế độ mặc định và chế độ phạm vi ngày. Theo dõi đường đi của quá trình phân tích cú pháp và định dạng đầu vào của datepicker, sau đó xác minh rằng 2023-07-06 được hiển thị là 7/6/2023 thay vì 7/5/2023 mà không thay đổi giá trị ngày cơ bả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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
58/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.