<i18n dev> RFR: 8317742: ISO Standard Date Format implementation consistency on DateTimeFormatter and String.format [v5]

Claes Redestad redestad at openjdk.org
Tue Nov 7 13:51:40 UTC 2023


On Tue, 7 Nov 2023 13:28:06 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   use DecimalFormatSymbols#getMinusSign
>
> test/jdk/java/util/Formatter/BasicDateTime.java line 473:
> 
>> 471:                 "%tF",
>> 472:                 DecimalFormatSymbols.getInstance(localeEuES).getMinusSign() + "2023-01-13",
>> 473:                 LocalDate.of(-2023, 1, 13));
> 
> Needs some comments here, otherwise it would be a bit cryptic. Also, "eu-ES" locale using `\u2212` depends on the current CLDR implementation, so you might want to check all locales with  `Locale.availableLocale()`.

While it might be reasonable to localize using `getMinusSign()` this will introduce a new inconsistency with `DateTimeFormatter` (which *does not* localize minus signs in front of years): 

int minus = DecimalFormatSymbols.getInstance(Locale.forLanguageTag("eu-ES"))
    .getMinusSign()
minus ==> 8722

int first = DateTimeFormatter.ISO_DATE
    .withLocale(Locale.forLanguageTag("eu-ES"))
    .format(ZonedDateTime.now()
    .minus(4000, java.time.temporal.ChronoUnit.YEARS)
    .charAt(0)
first ==> 45

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16033#discussion_r1384939609


More information about the i18n-dev mailing list