This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29765 - [FO31] 9.8.4.4 Formatting the Year Component
Summary: [FO31] 9.8.4.4 Formatting the Year Component
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Functions and Operators 3.1 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Kay
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-05 10:51 UTC by Tim Mills
Modified: 2016-12-16 19:55 UTC (History)
1 user (show)

See Also:


Attachments

Description Tim Mills 2016-08-05 10:51:42 UTC
Under "9.8.4.4 Formatting the Year Component" the text says

"The rules for the Year component (Y) are the same as those in 9.8.4.3 Formatting Integer-Valued Date/Time Components, except that the value of the year as output is the value of the year component of the supplied value modulo ten to the power N where N is determined as follows:

1.    If the width modifier is present and includes a maximum width, then that maximum width, or 2, whichever is greater.

2.    Otherwise, if the first presentation modifier takes the form of a decimal-digit-pattern, then the number of optional-digit-signs and mandatory-digit-signs in that decimal-digit-pattern, or 2, whichever is greater."


It's not clear whether a width modifier of the form:

  2-*

is considered to include a maximum width.

Consider the formats

(A) [Y0,3]
(B) [Y0,3-6]
(C) [Y0,3-*]

In (A), a width modifier is present, but does not include a maximum width.  Therefore N = 2 (rule 2 applies).  This seems odd.  Surely the maximum width is unbounded?

In (B), a width modifier is present, width a maximum width.  Therefore N = 
max(6, 2), i.e. N = 6 (rule 1 applies).

In (C), a width modifier is present, includes a maximum width, but the maximum width does not have an integer value.



This relates to test case format-date-043.
Comment 1 Tim Mills 2016-08-05 13:29:07 UTC
Related,

[Y0] has no width modifier.

Does [Y0,*-*]?
Comment 2 Tim Mills 2016-08-05 13:46:45 UTC
Related,

With formats

[f111,2] or [f111,2-*]

Given the text "A format token containing more than one digit, such as 001 or 9999, sets the minimum and maximum width to the number of digits appearing in the format token; if a width modifier is also present, then the width modifier takes precedence."

is the maximum width here unbounded or 3?
Comment 3 Tim Mills 2016-08-10 15:49:36 UTC
It's also unclear when formatting "[Y]" whether, when applying the rules of 9.8.4.4 the default presentation modifier of "1" applies before considering rule (2).

Should the default presentation modifier for Y not be 0001?
Comment 4 Michael Kay 2016-09-06 14:49:24 UTC
I think "includes a maximum width" should be read as "defines a finite maximum width". So case (C) does not define a finite maximum width.

I'm open to suggestions on [Y0]. For fractional seconds we treat a picture with a single digit specially and we should probably do so here.
Comment 5 Michael Kay 2016-09-06 21:42:25 UTC
I propose the following rewrite:

The rules for the Year component (Y) are the same as those in <specref ref="formatting-integer-valued-components"/>, except that the value  of the year as output is the value of the year component of the supplied value modulo ten to the power <var>N</var> where <var>N</var> is determined as follows:
		         
* If the width modifier is present and defines a finite maximum width, then that maximum width.

* Otherwise, if the first presentation modifier takes the form of a decimal-digit-pattern, then:

** let W be the number of optional-digit-signs and mandatory-digit-signs in that decimal-digit-pattern.

** if W is 2 or more, then W. 

* Otherwise, <var>N</var> is infinity (that is the year is output in full).
Comment 6 Andrew Coleman 2016-09-16 10:25:37 UTC
At the meeting on 2016-09-13, the WG agreed to adopt the change proposed in comment #5.
Action A-653-01 was raised to track this.
Comment 7 Michael Kay 2016-09-20 21:06:46 UTC
The changes have been applied.