angular / angular/components

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

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

説明

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

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

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

調査の方向性

まず main.ts のロケール登録と、app.config.ts のネイティブ日付アダプターおよび MAT_DATE_LOCALE の設定を確認します。ar-SA ロケールで日付ピッカーを再現し、表示されたヒジュラ暦の月と日が選択した値と一致すること、具体的には 30 Shawal ではなく 22 Muharram になることを確認します。

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

評価

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

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

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