This code:
java.time.LocalDateTime.parse("4714-11-24 00:00:00 BC", java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss G", Locale.ROOT));
fails to parse afterJDK-8306116 (CLDR 44.0 update).
Running the code in jshell before I get:
$ ./jdk-22+23/bin/jshell
| Welcome to JShell -- Version 22-beta
| For an introduction type: /help intro
jshell> java.time.LocalDateTime.parse("4714-11-24 00:00:00 BC", java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss G", Locale.ROOT));
$1 ==> -4713-11-24T00:00
jshell>
After I get:
bin/jshell
| Welcome to JShell -- Version 22-internal
| For an introduction type: /help intro
jshell> java.time.LocalDateTime.parse("4714-11-24 00:00:00 BC", java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss G", Locale.ROOT));
| Exception java.time.format.DateTimeParseException: Text '4714-11-24 00:00:00 BC' could not be parsed at index 20
| at DateTimeFormatter.parseResolved0 (DateTimeFormatter.java:2108)
| at DateTimeFormatter.parse (DateTimeFormatter.java:2010)
| at LocalDateTime.parse (LocalDateTime.java:494)
| at (#1:1)
jshell>
java.time.LocalDateTime.parse("4714-11-24 00:00:00 BC", java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss G", Locale.ROOT));
fails to parse after
Running the code in jshell before I get:
$ ./jdk-22+23/bin/jshell
| Welcome to JShell -- Version 22-beta
| For an introduction type: /help intro
jshell> java.time.LocalDateTime.parse("4714-11-24 00:00:00 BC", java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss G", Locale.ROOT));
$1 ==> -4713-11-24T00:00
jshell>
After I get:
bin/jshell
| Welcome to JShell -- Version 22-internal
| For an introduction type: /help intro
jshell> java.time.LocalDateTime.parse("4714-11-24 00:00:00 BC", java.time.format.DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss G", Locale.ROOT));
| Exception java.time.format.DateTimeParseException: Text '4714-11-24 00:00:00 BC' could not be parsed at index 20
| at DateTimeFormatter.parseResolved0 (DateTimeFormatter.java:2108)
| at DateTimeFormatter.parse (DateTimeFormatter.java:2010)
| at LocalDateTime.parse (LocalDateTime.java:494)
| at (#1:1)
jshell>
- duplicates
-
JDK-8320747 Java 22.ea.25-open: DateTimeFormatter should format IsoEra.BCE as BC in Locale.ROOT
- Closed
- relates to
-
JDK-8320537 Release Note: Gregorian Era Names with `java.time.format` APIs
- Resolved
-
JDK-8306116 Update CLDR to Version 44.0
- Resolved