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

Add java.time.format.DateTimeFormatter localizedBy(locale) method to reflect Unicode extensions

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 10
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      None, since localizedBy() is a new method.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Add java.time.format.DateTimeFormatter localizedBy(locale) to reflect "ca", "nu", "tz", and/or "rg" Unicode extensions

      Problem

      JEP 314 introduces additional Unicode extensions, such as "tz" time zone extension. To utilize this extension, a new method, localizedBy(Locale), needs to be introduced in java.time.format.DateTimeFormatter class. There has been the method "withLocale(Locale)" which applies text and/or pattern localization to the formatter, but the effect is independent of other withXXXX() method invocations, such as withZone(). Modifying withLocale() to recognize Unicode extensions would break that assumption. Thus the localizedBy(Locale) is needed to override the locale defaults.

      Solution

      Introduce a new method, localizedBy(Locale), that reflects the elements in the specified locale, and overrides the locale defaults in the formatter. Also, added some clarifications to java.time.format.DecimalStyle.of(), java.time.format.DateTimeFormatterBuilder.getLocalizedDateTimePattern() and java.util.Calendar.getInstance() methods.

      Specification

      http://cr.openjdk.java.net/~naoto/8191349/specdiff.04/overview-summary.html

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: