angular / angular/components

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

Ouverte
#29,500 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area: material/datepicker i18n
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

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

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par examiner l’enregistrement de la locale dans main.ts, ainsi que l’adaptateur de dates natif et la configuration de MAT_DATE_LOCALE dans app.config.ts. Reproduisez le sélecteur de date avec la locale ar-SA, puis vérifiez que le mois et le jour hégiriens affichés correspondent à la valeur sélectionnée, précisément 22 Muharram plutôt que 30 Shawal.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend, localization
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.