[Bug 29515] New: The expected result of format-dateTime-011 is incorrect

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

            Bug ID: 29515
           Summary: The expected result of format-dateTime-011 is
                    incorrect
           Product: XPath / XQuery / XSLT
           Version: Candidate Recommendation
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 3 & XPath 3 Test Suite
          Assignee: oneil@saxonica.com
          Reporter: josh.spiegel@oracle.com
        QA Contact: public-qt-comments@w3.org
  Target Milestone: ---

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
<quote>
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.
</quote>


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

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

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

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

Received on Wednesday, 2 March 2016 18:21:57 UTC