angular / angular/components

bug(Datepicker): Datepicker with Moment ignores locale

未关闭
#28,263 20 条评论 6 个 reaction 已指派 0 人 在 GitHub 查看
area: material/datepicker P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
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

16

### Description

Since updating to Angular 17, my mat-datepicker ignores my locale. Everything should be in German but instead it's all in English now.

### Reproduction

StackBlitz link: https://components-issue-uudyxr.stackblitz.io
Steps to reproduce:
1. Open the datepicker to select a date
2. Select a year and a month

### Expected Behavior

The months are displayed in German (screenshot taken from production environment that doesn't have the update to Angular 17 yet).

![image](https://github.com/angular/components/assets/141422285/662124c9-f17b-4181-a378-a103ee3c9d25)
![image](https://github.com/angular/components/assets/141422285/ce836090-536a-448b-b58f-80e88172da78)

### Actual Behavior

The months are displayed in English

![image](https://github.com/angular/components/assets/141422285/dc658296-25f4-4221-9938-1b0b62df07e8)
![image](https://github.com/angular/components/assets/141422285/5ff86a70-2566-4979-8117-aa35ce27a4f8)

### Environment

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

贡献指南

打开贡献指南

调研方向

从链接的 StackBlitz 复现开始,检查使用 Moment 和德语 locale 配置的 mat-datepicker。比较 Angular 16 与 Angular 17 之间的行为,然后跟踪 datepicker 的 locale 处理,以确定月份名称为何会回退为英语。完成的标准是:升级后复现能够显示德语月份名称,并且该回归问题已由项目相关测试覆盖。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。