angular / angular/components

datepicker: shows date using provided LOCALE_ID but parses date using default US locale (or a combination of them)

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

説明

#### Bug, feature request, or proposal:
Bug. I don't think it is working like that on purpose.

#### What is the expected behavior?
Date picker uses provided en-GB LOCALE_ID for parsing typed in date - 27/10/2018 input manually by typing is valid

#### What is the current behavior?
Typed date is parsed using US locale - 27/10/2018 input manually is invalid, 12/01/2018 is December, not January.

#### What are the steps to reproduce?
https://stackblitz.com/edit/angular-datepicker-locale?file=main.ts

1. Select 27/10/2018 using date picker.
2. Modify the date by editing the input to 26/10/2018
3. Observe invalid input

#### What is the use-case or motivation for changing an existing behavior?
Make material datepicker great again! But seriously: it seems like if a culture is provided it should affect both parsing and formatting aspects of dealing with dates and not format it into a date which is considered invalid when updated by typing.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
As in demo: Angular 7.1.0 Material 7.1.0. It fails validation on chrome if day (month?) is over 12, but on IE 11 is more curious as it modifies the year, I am fairly sure the swap issue causes it to work incorrectly on any browser.

#### Is there anything else we should know?
I think it may have been an issue with parsing the text date from text - it seems like it would parse using US culture ignoring provided locale.

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

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

調査の方向性

リンクされた StackBlitz とその main.ts から始め、日付を選択してから編集することで en-GB datepicker の動作を再現します。datepicker が入力された値をどのようにフォーマットおよび解析するかを追跡し、その後、27/10/2018 のような日付が提供された locale と一貫して受け入れられ、既存の再現でバリデーションに失敗しなくなっていることを確認します。

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

評価

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

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

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