angular / angular/components

date picker using 'ar-SA' locale, displayed dates not correct, while value is ok.

Đang mở
#29,500 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
area: material/datepicker i18n
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?

- [X] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

17

### Description

I used to use Date Picker with Hijri dates, using native adabter and every thing works fine, after updating to angular 18.1 I got this issue:

* in main.ts => regist SA locale

```
import LocaleSA from '@angular/common/locales/ar-SA';
registerLocaleData(LocaleSA, LanguageEnum.AR);
```

* in app.config.ts => provide native adapter

```
provideNativeDateAdapter(),
{ provide: MAT_DATE_LOCALE, useValue: 'ar-SA' },
```

![image](https://github.com/user-attachments/assets/1d824c32-7e79-4247-9c3d-79e7c8daf17f)

### Reproduction

StackBlitz link:
Steps to reproduce:
1.
2.

### Expected Behavior

I expect to see the correct Hijri date in this case Muharram / محرم first month of Hijri year not Shawal / شوال, and day is 22 not 30

### Actual Behavior

the calendar point at 30/Shawal not 22/Muharram, 30/شوال not 22/محرم

### Environment

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

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 xem lại việc đăng ký locale trong main.ts, cùng với native date adapter và cấu hình MAT_DATE_LOCALE trong app.config.ts. Tái hiện date picker với locale ar-SA, sau đó xác minh rằng tháng và ngày Hijri được hiển thị khớp với giá trị đã chọn, cụ thể là 22 Muharram thay vì 30 Shawal.

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, localization
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
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.