<i18n dev> Additional Date-Time Formats

Naoto Sato naoto.sato at oracle.com
Thu Jan 27 19:22:38 UTC 2022


Hi Stephen,

On 1/27/22 1:00 AM, Stephen Colebourne wrote:
> Hi,
> This would be a useful addition. Some comments:
> 
> There is no need for the method overload that takes Locale. The other
> similar methods all operate using the locale of the formatter, and
> have this Javadoc:
> 
>       * The locale is determined from the formatter. The formatter
> returned directly by
>       * this method will use the {@link Locale#getDefault() default
> FORMAT locale}.
>       * The locale can be controlled using {@link
> DateTimeFormatter#withLocale(Locale) withLocale(Locale)}
>       * on the result of this method.
> 
> And `appendLocalizedPattern` should not take a Locale either. Again ,
> it would use the locale of the formatter instance, calculating the
> actual pattern on-demand when the formatter is run.

That makes sense. Will revise the spec.

Now come to think of it, I came up with the draft based on `ofPattern()` 
methods. One of them is a overload method that takes a Locale argument. 
Why is it so?

> 
> The spec Javadoc doesn't explain what repeating the pattern letter
> actually does/means. Is "M" the same as "MMMM"?

That depends on the locale and the availability of the formats. For 
example, 'M' translates into these patterns in each locale with 
Gregorian calendar:

https://unicode-org.github.io/cldr-staging/charts/40/by_type/date_&_time.gregorian.html#959cbb42bb2962f

Naoto


More information about the core-libs-dev mailing list