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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P4
    • None
    • 11.0.2
    • core-libs
    • 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

              naoto Naoto Sato
              ysatowse Yoshiki Sato (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: