Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8320747

Java 22.ea.25-open: DateTimeFormatter should format IsoEra.BCE as BC in Locale.ROOT

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 22
    • core-libs
    • None

      Here's the test code:

      ```java
      DateTimeFormatter shortFormat =
          new DateTimeFormatterBuilder()
              .appendPattern("GG")
              .toFormatter(Locale.ROOT);
      DateTimeFormatter longFormat =
          new DateTimeFormatterBuilder()
              .appendPattern("GGGG")
              .toFormatter(Locale.ROOT);
      System.out.println("short era: " + shortFormat.format(IsoEra.BCE));
      System.out.println(" long era: " + longFormat.format(IsoEra.BCE));
      ```

      Java 21 (the result is the same for all Java versions below 21):
      short era: BC
       long era: BCE

      Java 22.ea.25-open:
      short era: BCE
       long era: BCE

      The issue was discovered as I added Java 22 to the CI matrix in pgjdbc: https://github.com/pgjdbc/pgjdbc/pull/3026

            Unassigned Unassigned
            vsitnikov Vladimir Sitnikov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: