[Bug 29789] format-time-023u incorrect result

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29789

Michael Kay <mike@saxonica.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mike@saxonica.com
             Status|NEW                         |ASSIGNED

--- Comment #2 from Michael Kay <mike@saxonica.com> ---
I was asked to review this (action A-659-04). My interpretation is as follows:

(a) There is no explicit presentation modifier, so the default kicks in, which
is "1" (ยง9.8.4.1).

(b) In the width modifier, "*" means "there is no explicit minimum". It's not
entirely clear what this means. Specifying zero explicitly would be an error.
So I think it makes sense to interpret "*" as "1".

Section 9.8.4.5:

9.8.4.5 Formatting Fractional Seconds

The output for the fractional seconds component (f) is equivalent to the result
of the following algorithm:

(1) If the first presentation modifier contains no Unicode digit, then the
output is implementation-defined.

We've defaulted the presentation modifier to "1" so it does contain a Unicode
digit.

(2) Otherwise, the value of the fractional seconds is output as follows:

(2a) If there is no width modifier and ... N/A

(2b) If there is a width modifier, then the first presentation modifier is
adjusted as follows:
The number of mandatory-digit-sign characters in the first presentation
modifier is increased if necessary. This is done first by replacing
optional-digit-signs with mandatory-digit-signs, starting from the left, and
then appending mandatory-digit-signs to the presentation modifier, until the
number of mandatory-digit-signs is equal to the minimum width. 

See above, "there is no explicit minimum". So it's not at all clear what
happens here. My vote would be to treat "*" as implying minimum width 1, which
means that the first presentation modifier remains "1". In comment #1, Josh
appears to have decided that the minimum width is 2; I can't see the rationale
for that.

(2c) "1" reversed is "1"

(2d) => 600

(2e) => "600"

(2f) => "006"

(2g) => "0"

which is the expected result.

This hinges on an interpretation that "*" as the minimum width in a width
specifier means "1", which is the lowest legal value. I can't see any logic for
treating it as meaning "2".

I would suggest resolving this ambiguity by prepending to 9.8.4.5 2.b.i the
phrase "If a minimum width is specified, ". This change has the same effect as
treating the minimum width as 1. The expected test result is then correct.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Wednesday, 16 November 2016 14:51:00 UTC