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

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • None
    • core-libs
    • None
    • b61

           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());

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

                Created:
                Updated:
                Resolved: