<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>29765</bug_id>
          
          <creation_ts>2016-08-05 10:51:42 +0000</creation_ts>
          <short_desc>[FO31] 9.8.4.4 Formatting the Year Component</short_desc>
          <delta_ts>2016-12-16 19:55:28 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Functions and Operators 3.1</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Tim Mills">tim</reporter>
          <assigned_to name="Michael Kay">mike</assigned_to>
          <cc>andrew_coleman</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>127100</commentid>
    <comment_count>0</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2016-08-05 10:51:42 +0000</bug_when>
    <thetext>Under &quot;9.8.4.4 Formatting the Year Component&quot; the text says

&quot;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.&quot;


It&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127102</commentid>
    <comment_count>1</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2016-08-05 13:29:07 +0000</bug_when>
    <thetext>Related,

[Y0] has no width modifier.

Does [Y0,*-*]?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127103</commentid>
    <comment_count>2</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2016-08-05 13:46:45 +0000</bug_when>
    <thetext>Related,

With formats

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

Given the text &quot;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.&quot;

is the maximum width here unbounded or 3?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127114</commentid>
    <comment_count>3</comment_count>
    <who name="Tim Mills">tim</who>
    <bug_when>2016-08-10 15:49:36 +0000</bug_when>
    <thetext>It&apos;s also unclear when formatting &quot;[Y]&quot; whether, when applying the rules of 9.8.4.4 the default presentation modifier of &quot;1&quot; applies before considering rule (2).

Should the default presentation modifier for Y not be 0001?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127303</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-09-06 14:49:24 +0000</bug_when>
    <thetext>I think &quot;includes a maximum width&quot; should be read as &quot;defines a finite maximum width&quot;. So case (C) does not define a finite maximum width.

I&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127319</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-09-06 21:42:25 +0000</bug_when>
    <thetext>I propose the following rewrite:

The rules for the Year component (Y) are the same as those in &lt;specref ref=&quot;formatting-integer-valued-components&quot;/&gt;, 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 &lt;var&gt;N&lt;/var&gt; where &lt;var&gt;N&lt;/var&gt; 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, &lt;var&gt;N&lt;/var&gt; is infinity (that is the year is output in full).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127401</commentid>
    <comment_count>6</comment_count>
    <who name="Andrew Coleman">andrew_coleman</who>
    <bug_when>2016-09-16 10:25:37 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127455</commentid>
    <comment_count>7</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2016-09-20 21:06:46 +0000</bug_when>
    <thetext>The changes have been applied.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>