Add Reiwa era to date input calendarPicker
Bug: 919712
Change-Id: I31f84d0ee562d806f36fd4d8e7eaf9e1c0ae0a5c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1546739
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Hajime Hoshi <hajimehoshi@chromium.org>
Reviewed-by: Keishi Hattori <keishi@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646210}
diff --git a/third_party/blink/renderer/core/html/forms/resources/calendarPicker.js b/third_party/blink/renderer/core/html/forms/resources/calendarPicker.js
index 9c224958..762ac43 100644
--- a/third_party/blink/renderer/core/html/forms/resources/calendarPicker.js
+++ b/third_party/blink/renderer/core/html/forms/resources/calendarPicker.js
@@ -105,10 +105,10 @@
// limitation.
if (year > ImperialEraLimit)
return '';
- if (year >= 2020 || year == 2019 && month >= 4) {
- // TODO(tkent): Next of Heisei is not published yet.
- return '';
- }
+ if (year >= 2020)
+ return '(\u4ee4\u548c' + localizeNumber(year - 2018) + '\u5e74)';
+ if (year == 2019 && month >= 4)
+ return '(\u4ee4\u548c\u5143\u5e74)';
if (year > 1989)
return '(\u5e73\u6210' + localizeNumber(year - 1988) + '\u5e74)';
if (year == 1989)
diff --git a/third_party/blink/web_tests/fast/forms/calendar-picker/japanese-era-names.html b/third_party/blink/web_tests/fast/forms/calendar-picker/japanese-era-names.html
index 3a9f4a63..e6d63a1 100644
--- a/third_party/blink/web_tests/fast/forms/calendar-picker/japanese-era-names.html
+++ b/third_party/blink/web_tests/fast/forms/calendar-picker/japanese-era-names.html
@@ -17,13 +17,16 @@
let pw = popupWindow;
const NEN = '\u5e74';
const GANNEN = '\u5143\u5e74';
+ const REIWA = '\u4ee4\u548c';
const HEISEI = '\u5e73\u6210';
const SYOUWA = '\u662d\u548c';
const TAISYOU = '\u5927\u6b63';
const MEIJI = '\u660e\u6cbb';
const JAN = 0, APR = 3, MAY = 4, JUL = 6, AUG = 7, DEC = 11;
- assert_equals(pw.formatJapaneseImperialEra(2117, JAN), '');
- assert_equals(pw.formatJapaneseImperialEra(2019, MAY), '');
+ assert_equals(pw.formatJapaneseImperialEra(2118, JAN), '');
+ assert_equals(pw.formatJapaneseImperialEra(2117, JAN), `(${REIWA}99${NEN})`);
+ assert_equals(pw.formatJapaneseImperialEra(2020, JAN), `(${REIWA}2${NEN})`);
+ assert_equals(pw.formatJapaneseImperialEra(2019, MAY), `(${REIWA}${GANNEN})`);
assert_equals(pw.formatJapaneseImperialEra(2019, APR), `(${HEISEI}31${NEN})`);
assert_equals(pw.formatJapaneseImperialEra(1990, JAN), `(${HEISEI}2${NEN})`);
assert_equals(pw.formatJapaneseImperialEra(1989, JAN), `(${HEISEI}${GANNEN})`);