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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 11.0.2
    • core-libs
    • None

      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

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

              Created:
              Updated:
              Resolved: