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

DateTimeFormatter does not parse/accept the era.toString() result from MinguoEra/ThaiBuddhistEra

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b61

      Backports

        Description

           protected final DateTimeFormatter CHRONO_FORMAT = new
        DateTimeFormatterBuilder()
             .optionalStart()
             .appendChronologyId()
             .appendLiteral(' ')
             .optionalEnd()
             .optionalStart()
             .appendText(ChronoField.ERA, TextStyle.FULL) // FAILS HERE
             .appendLiteral(' ')
             .optionalEnd()
             .appendValue(ChronoField.YEAR_OF_ERA, 1, 9, SignStyle.NORMAL)
             .appendLiteral('-')
             .appendValue(ChronoField.MONTH_OF_YEAR, 1, 2, SignStyle.NEVER)
             .appendLiteral('-')
             .appendValue(ChronoField.DAY_OF_MONTH, 1, 2, SignStyle.NEVER)
             .toFormatter();

        will parse HijrahDate and JapaneseDate toString values, but not MinguoDate
        or ThaiBuddhistDate. It fails when trying to parse the era. I've also tried
        TextStyle.Short, appendPattern("G") and appendPattern("GGGG"). All fail in
        exactly the same place.

           CHRONO_FORMAT.parse(HijrahDate.of(1970, 02, 03).toString());
           CHRONO_FORMAT.parse(JapaneseDate.of(1970, 02, 03).toString())
           CHRONO_FORMAT.parse(MinguoDate.of(1970, 02, 03).toString());
           CHRONO_FORMAT.parse(ThaiBuddhistDate.of(1970, 02, 03).toString());

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  sherman Xueming Shen
                  Reporter:
                  sherman Xueming Shen
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: