Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8310182

DateTimeFormatter date formats (ISO_LOCAL_DATE) separated with hyphen, not dash

    XMLWordPrintable

Details

    • b04
    • generic
    • generic

    Backports

      Description

        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


        Attachments

          Issue Links

            Activity

              People

                naoto Naoto Sato
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: