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

DateTimeFormatter pattern letter 'g'

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 9
    • core-libs
    • b116

      The CLDR specification includes pattern letter 'g'.
      http://www.unicode.org/reports/tr35/tr35-41/tr35-dates.html#Date_Format_Patterns

      "Modified Julian day. This is different from the conventional Julian day number in two regards. First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; that is, it depends on the local time zone. It can be thought of as a single number that encompasses all the date-related fields."

      This definition matches the field `JulianFields.MODIFIED_JULIAN_DAY` thus adding it as a new pattern will be easy.

      The documentation of `DateTimeFormatter` must have an additional line added (after "d"). The documentation of `DateTimeFormatterBuilder.appendPattern` must have an additional line added (after "F"). The private method `parseField` must have a new case statement added for "g". The private FIELD_MAP must be updated and the "LDML - g" comment line removed.

      The field should use `appendValue(JulianFields.,MODIFIED_JULIAN_DAY n, 19, SignStyle.NORMAL)` where n is the number of pattern letters.

      While making this change, the method documentation of `DateTimeFormatterBuilder.appendPattern` should have the semicolons removed from the end of each line in the table.

            ntv Nadeesh Tv
            scolebourne Stephen Colebourne
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: