RFR: 8317742: ISO Starndard Date Format implementation consistency on DateTimeFormatter and String.format
温绍锦
duke at openjdk.org
Mon Oct 9 22:30:57 UTC 2023
On Tue, 3 Oct 2023 21:37:46 GMT, 温绍锦 <duke at openjdk.org> wrote:
> j.u.Formatter now prints "%tF" (iso standard date) and the result is incorrect when processing year < 0 or year > 9999
When String.format handles "%tF" Specifier, it uses the same behavior as DateTimeFormatter. This will cause the value of printed year to be incompatible with the previous behavior.
The year value range [-∞, -1000] changes:
// String.format("%tF", LocalDate.of(-10000, 1, 1))
before 10001-01-01
after -99999-01-01
The year value range [-9999, -1] changes:
// String.format("%tF", LocalDate.of(-1, 1, 1))
before 0002-01-01
after -0001-01-01
The year value range [-∞, -1000] changes:
//String.format("%tF", LocalDate.of(10000, 1, 1)):
before 10000-01-01
after +10000-01-01
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16033#issuecomment-1753981207
More information about the core-libs-dev
mailing list