<?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>29515</bug_id>
          
          <creation_ts>2016-03-02 18:21:54 +0000</creation_ts>
          <short_desc>The expected result of format-dateTime-011 is incorrect</short_desc>
          <delta_ts>2016-03-08 18:03:51 +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>XQuery 3 &amp; XPath 3 Test Suite</component>
          <version>Candidate Recommendation</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</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="Josh Spiegel">josh.spiegel</reporter>
          <assigned_to name="O&apos;Neil Delpratt">oneil</assigned_to>
          <cc>benito</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>125330</commentid>
    <comment_count>0</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2016-03-02 18:21:54 +0000</bug_when>
    <thetext>See:
https://github.com/LeoWoerteler/QT3TS/blob/17419434879ee1eeeb6fc1be81e1df063e363a17/fn/format-dateTime.xml#L533

For a sequence of months, this test prints out the [w] value for the first day of each month.  If the first day of the month falls in the first week of the month, the test expects [w]==1 (which is correct).  However, if the first day is not in the first week of the month, it always expects [w]==5 (which is only sometimes correct).  The problem is that sometimes the first day of the month falls in week 4 (not 5) of the previous month.  For example, consider:

   [2008-03-01T12:00:00: 5

The calendar for February/March 2008:

 February 2008
   S  M  T  W  T  F  S
                  1  2
   3  4  5  6  7  8  9
   10 11 12 13 14 15 16
   17 18 19 20 21 22 23
   24 25 26 27 28 29  

 March 2008
   S  M  T  W  T  F  S
                     1
   2  3  4  5  6  7  8
   ...   
   
March 1st is not in the first week of march.  It is in the 4th week of February.  However, the test expects it in the 5th week of February. 

Here is the relevant part of the spec:
https://www.w3.org/TR/xpath-functions-31/#rules-for-datetime-formatting
&lt;quote&gt;
ISO 8601 does not define a numbering for weeks within a month. When the w component is used, the convention to be adopted is that each Monday-to-Sunday week is considered to fall within a particular month if its Thursday occurs in that month; the weeks that fall in a particular month under this definition are numbered starting from 1. Thus, for example, 29 January 2013 falls in week 5 because the Thursday of the week (31 January 2013) is the fifth Thursday in January, and 1 February 2013 is also in week 5 for the same reason.
&lt;/quote&gt;


History
------------
This bug is relevant:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=21794

Comment 0 suggests:
&quot;Every expected week number of &quot;0&quot; should be a &quot;5&quot;, i.e., the 5th week of the previous month.&quot;

Which was applied here:
https://github.com/LeoWoerteler/QT3TS/commit/c105cefb05d2d334ed04da0888614635ac7f492b#diff-e0aeb5496b2546ae68a1e5827d02e6df

Here are a list of dates covered by this test where I think 5 should instead be 4:
 
  2006-10-01T12:00:00
  2007-07-01T12:00:00
  2008-03-01T12:00:00
  2009-03-01T12:00:00</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125386</commentid>
    <comment_count>1</comment_count>
    <who name="O&apos;Neil Delpratt">oneil</who>
    <bug_when>2016-03-08 18:01:24 +0000</bug_when>
    <thetext>*** Bug 29493 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>125387</commentid>
    <comment_count>2</comment_count>
    <who name="Josh Spiegel">josh.spiegel</who>
    <bug_when>2016-03-08 18:03:02 +0000</bug_when>
    <thetext>The working group accepted the modification proposed in comment 0.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>