-
Bug
-
Resolution: Fixed
-
P4
-
20
-
b04
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8311349 | 21.0.1 | Naoto Sato | P4 | Resolved | Fixed | b02 |
JDK-8310977 | 21 | Naoto Sato | P4 | Resolved | Fixed | b29 |
A DESCRIPTION OF THE PROBLEM :
According to ISO_LOCAL_DATE's JavaDoc:
This returns an immutable formatter capable of formatting and parsing
* the ISO-8601 extended local date format.
* The format consists of:
* <ul>
* <li>Four digits or more for the {@link ChronoField#YEAR year}.
* Years in the range 0000 to 9999 will be pre-padded by zero to ensure four digits.
* Years outside that range will have a prefixed positive or negative symbol.
* <li>A dash
* <li>Two digits for the {@link ChronoField#MONTH_OF_YEAR month-of-year}.
* This is pre-padded by zero to ensure two digits.
* <li>A dash
* <li>Two digits for the {@link ChronoField#DAY_OF_MONTH day-of-month}.
* This is pre-padded by zero to ensure two digits.
The separator which splits years from months and months from days is the *hyphen-minus* (U+0x002D), ASCII's ambiguous character which is the only one resembling minuses, hyphens and dashes, not an actual dash, so calling it a dash is at least misleading.
Other DateTimeFormatter date formats (ISO_ORDINAL_DATE and ISO_WEEK_DATE) must have the same issue.
ISO 8601 uses hyphens as separators, so actually returning dashes would not comply. On the other hand, the hyphen-minus is the CSS hyphenate-character, so just changing the documentation will leave the issue that web pages consider such dates as containing line breaking opportunities, causing dates at the end of a line to be split on 2 lines. One solution might be to use the NON-BREAKING HYPHEN (U+0x2011).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
ImHex can be used to open DateTimeFormatter.java and validate the issue, which can be found at line 801 (among others).
FREQUENCY : always
According to ISO_LOCAL_DATE's JavaDoc:
This returns an immutable formatter capable of formatting and parsing
* the ISO-8601 extended local date format.
* The format consists of:
* <ul>
* <li>Four digits or more for the {@link ChronoField#YEAR year}.
* Years in the range 0000 to 9999 will be pre-padded by zero to ensure four digits.
* Years outside that range will have a prefixed positive or negative symbol.
* <li>A dash
* <li>Two digits for the {@link ChronoField#MONTH_OF_YEAR month-of-year}.
* This is pre-padded by zero to ensure two digits.
* <li>A dash
* <li>Two digits for the {@link ChronoField#DAY_OF_MONTH day-of-month}.
* This is pre-padded by zero to ensure two digits.
The separator which splits years from months and months from days is the *hyphen-minus* (U+0x002D), ASCII's ambiguous character which is the only one resembling minuses, hyphens and dashes, not an actual dash, so calling it a dash is at least misleading.
Other DateTimeFormatter date formats (ISO_ORDINAL_DATE and ISO_WEEK_DATE) must have the same issue.
ISO 8601 uses hyphens as separators, so actually returning dashes would not comply. On the other hand, the hyphen-minus is the CSS hyphenate-character, so just changing the documentation will leave the issue that web pages consider such dates as containing line breaking opportunities, causing dates at the end of a line to be split on 2 lines. One solution might be to use the NON-BREAKING HYPHEN (U+0x2011).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
ImHex can be used to open DateTimeFormatter.java and validate the issue, which can be found at line 801 (among others).
FREQUENCY : always
- backported by
-
JDK-8310977 DateTimeFormatter date formats (ISO_LOCAL_DATE) separated with hyphen, not dash
- Resolved
-
JDK-8311349 DateTimeFormatter date formats (ISO_LOCAL_DATE) separated with hyphen, not dash
- Resolved
- links to
-
Commit openjdk/jdk21/df26258d
-
Commit openjdk/jdk/ec45bd64
-
Review openjdk/jdk21/70
-
Review openjdk/jdk/14620
(1 links to)