JDK-8358819 : The first year is not displayed correctly in Japanese Calendar
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util:i18n
  • Affected Version: 23,24,25
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2025-06-06
  • Updated: 2025-07-14
  • Resolved: 2025-06-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 25 JDK 26
25.0.1Fixed 26 b03Fixed
Related Reports
Causes :  
Description
This piece:
```
        var df = DateFormat.getDateInstance(DateFormat.FULL, new Locale("ja", "JP", "JP"));
        Calendar cal = Calendar.getInstance();
        cal.clear();
        cal.set(2019, Calendar.MAY, 1);
        System.out.println(df.format(cal.getTime()));
```
displays "令和1年5月1日水曜日"
which should be "令和元年5月1日水曜日"

This seems to be a regression caused by removing COMPAT, as the date format for the Japanese calendar differs between COMPAT and CLDR (as to year, "yyyy" and "y" respectively). JapaneseImperialCalendar uses "元" only for Calendar.LONG pattern, thus the latter (CLDR) is considered SHORT

One workaround is to explicitly specify patterns with 4 letters of "y", such as
```
var df = new SimpleDateFormat("GGGGyyyy'年'M'月'd'日'EEEE", new Locale("ja", "JP", "JP));
```

The bug is inherently there before the COMPAT removal. If the locale was created with `Locale.forLanguageTag("ja-u-ca-japanese")`, this fails prior to COMPAT removal, because for "ja" locale, CLDR is always chosen, while "ja_JP_JP" locale is only supported by COMPAT.
Comments
[jdk25u-fix-request] Approval Request from Taizo Kurashige Clean backport. Fixes are adding arugements and a condition in cldrconverter, and test fix, risk is low. Testing: test/jdk/java/util/Calendar and :jdk_time on Windows Server 2022/RHEL9.4
09-07-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk25u/pull/16 Date: 2025-07-09 06:28:47 +0000
09-07-2025

Changeset: 99829950 Branch: master Author: Naoto Sato <naoto@openjdk.org> Date: 2025-06-12 18:04:14 +0000 URL: https://git.openjdk.org/jdk/commit/99829950f680936489048a1ad4ce12f166805e4d
12-06-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/25732 Date: 2025-06-10 18:36:15 +0000
10-06-2025