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

New era placeholder not recognized by java.text.SimpleDateFormat

    Details

      Backports

        Description

        System.out.println(new SimpleDateFormat("Y-M-d", Locale.US).format(new SimpleDateFormat("GGGGy年M月d日", Locale.forLanguageTag("ja-JP-u-ca-japanese")).parse("元号1年5月1日")))

        Expected Result:
        2019-5-1

        Actual Result:
        java.text.ParseException: Unparseable date: "元号1年5月1日"
        | at DateFormat.parse (DateFormat.java:395)
        | at (#55:1)


        On the other hand,

        System.out.println(new SimpleDateFormat("Y-M-d", Locale.US).format(new SimpleDateFormat("GGGGy年M月d日", Locale.forLanguageTag("ja-JP-u-ca-japanese")).parse("NewEra1-5-1")))

        Expected Result:
        => 2019-5-1

        Actual Result:
        java.text.ParseException: Unparseable date: "NewEra1-5-1"
        | at DateFormat.parse (DateFormat.java:395)
        | at (#2:1)

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: