Author aganders3
Recipients Erik.Cederstrand, aganders3, belopolsky, r.david.murray
Date 2011-05-26.22:38:03
SpamBayes Score 6.1189e-06
Marked as misclassified No
Message-id <1306449485.0.0.30853347649.issue12006@psf.upfronthosting.co.za>
In-reply-to
Content
I disagree, I think %G is necessary in strptime(). Take Monday, December 31, 2001 as an example. The ISO date is 2002 01 1.

Now, given only the Gregorian year (2001) for this date, and the ISO week and weekday (01 1), there is an ambiguity with Monday, January 1, 2001, which has an ISO date of 2001 01 1. The ISO week/weekday combination of (01 1) occurs twice in the year 2001, and can only be differentiated by the corresponding ISO year.

We can, of course, debate on what the behavior in this case should be. The way I see it, we can:
1) Assume the year taken in by %Y is equivalent to the ISO year, which it often is. Assuming %Y is the ISO year IFF %V is used accomplishes the same result.
2) Default the year to some value, currently 1900 is used when %Y is absent. This is how it is handled now.
3) Report an error/exception that insufficient data was provided, and maybe mention %G should be used instead of %Y for this case.

I'm attaching a patch now that includes some minor changes, includes %G and adds some tests. I am also working on the documentation but it's not quite ready.
History
Date User Action Args
2011-05-26 22:38:05aganders3setrecipients: + aganders3, belopolsky, r.david.murray, Erik.Cederstrand
2011-05-26 22:38:05aganders3setmessageid: <1306449485.0.0.30853347649.issue12006@psf.upfronthosting.co.za>
2011-05-26 22:38:04aganders3linkissue12006 messages
2011-05-26 22:38:04aganders3create