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

Timezone pattern "OOOO" does not result in the full "GMT+00:00" substring

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 14
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      No change to the implementation.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Clarify the definition of the "Offset O" pattern presentation in java.time.format.DateTimeFormatter class.

      Problem

      The pattern is based on the CLDR's "Localized GMT format", thus the hour/minute/second digits are omitted if the offset is zero. However the current spec does not clearly mention it, which may confuse the users.

      Solution

      Clearly mention the zero/non-zero offset cases in the class description.

      Specification

      Change the "Offset O" section of the class description of java.time.format.DateTimeFormatter class from:

      * <b>Offset O</b>: This formats the localized offset based on the number of
      * pattern letters. One letter outputs the {@linkplain TextStyle#SHORT short}
      * form of the localized offset, which is localized offset text, such as 'GMT',
      * with hour without leading zero, optional 2-digit minute and second if
      * non-zero, and colon, for example 'GMT+8'. Four letters outputs the
      * {@linkplain TextStyle#FULL full} form, which is localized offset text,
      * such as 'GMT, with 2-digit hour and minute field, optional second field
      * if non-zero, and colon, for example 'GMT+08:00'. Any other count of letters
      * throws {@code IllegalArgumentException}.

      to:

      * <b>Offset O</b>: With a non-zero offset, this formats the localized offset
      * based on the number of pattern letters. One letter outputs the
      * {@linkplain TextStyle#SHORT short} form of the localized offset, which is
      * localized offset text, such as 'GMT', with hour without leading zero, optional
      * 2-digit minute and second if non-zero, and colon, for example 'GMT+8'. Four
      * letters outputs the {@linkplain TextStyle#FULL full} form, which is localized
      * offset text, such as 'GMT, with 2-digit hour and minute field, optional second
      * field if non-zero, and colon, for example 'GMT+08:00'. If the offset is zero,
      * only localized text is output. Any other count of letters throws
      * {@code IllegalArgumentException}.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                naoto Naoto Sato
                Reporter:
                webbuggrp Webbug Group
                Reviewed By:
                Lance Andersen, Roger Riggs
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: