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

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

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P3
    • 10
    • core-libs
    • None
    • minimal
    • None, since localizedBy() is a new method.
    • Java API
    • 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

              naoto Naoto Sato
              naoto Naoto Sato
              Lance Andersen, Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: