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

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P3
    • 9
    • Affects Version/s: None
    • Component/s: 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());

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

                Created:
                Updated:
                Resolved: