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

The range of Japanese era is not correct when parsing from string

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 11.0.2
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      System.out.println(
        DateTimeFormatter.ofPattern("u-M-d").format(
          DateTimeFormatter.ofPattern("Gy年M月d日")
            .withChronology(JapaneseChronology.INSTANCE)
            .parse("平成31年5月1日")));

      System.out.println(
        new SimpleDateFormat("Y-M-d", Locale.US).format(
          new SimpleDateFormat("Gy年M月d日", new Locale("ja","JP","JP"))
            .parse("平成31年5月1日")))

      Expected Result:
        java.time.format.DateTimeParseException
        java.text.ParseException

      Actual Result:
        2019-5-1
        2019-5-1

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                naoto Naoto Sato
                Reporter:
                ysatowse Yoshiki Sato
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: