This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brett.cannon
Recipients
Date 2004-10-19.20:10:08
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=357491

Nick is seeing things the way I thought they are supposed to be; how can 
ending on a Monday make any difference for %U or %W?  Both start at 
after the beginning of the week, right?

Well, as George was pointing out, it shifts everything by a full week 
depending on the directive when the year starts on a Monday.  So under 
%U week 1 doesn't start until the first Sunday, while under %W week 1 
starts on Jan 1.  So the issue is when a year starts and end on a Monday, 
we are looking at Monday, but %U is used.

So the new patch attempts to handle this case.  I am now testing against 
the following dates:

        test_helper((1901, 1, 3), "week 0")
        test_helper((1901, 1, 8), "common case")
        test_helper((1901, 1, 13), "day on Sunday")
        test_helper((1901, 1, 14), "day on Monday")
        test_helper((1905, 1, 1), "Jan 1 on Sunday")
        test_helper((1906, 1, 1), "Jan 1 on Monday")
        test_helper((1906, 1, 7), "first Sunday in a year starting on 
Monday")
        test_helper((1905, 12, 31), "Dec 31 on Sunday")
        test_helper((1906, 12, 31), "Dec 31 on Monday")
        test_helper((2008, 12, 29), "Monday in the last week of the year")
        test_helper((2008, 12, 22), "Monday in the second-to-last week of 
the "
                                    "year") 
        test_helper((1978, 10, 23), "randomly chosen date")
        test_helper((2004, 12, 18), "randomly chosen date")
        test_helper((1978, 10, 23), "year starting and ending on Monday 
while "
                                        "date not on Sunday or Monday")
        test_helper((1917, 12, 17), "year starting and ending on Monday 
with "
                                        "a Monday not at the beginning or end "
                                        "of the year")
        test_helper((1917, 12, 31), "Dec 31 on Monday with year starting 
and "
                                        "ending on Monday")
History
Date User Action Args
2007-08-23 14:26:37adminlinkissue1045381 messages
2007-08-23 14:26:37admincreate