diff options
author | Brett Cannon <bcannon@gmail.com> | 2005-08-29 18:25:55 +0000 |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2005-08-29 18:25:55 +0000 |
commit | 502b4711f1dc766a93504a1367ddf0c3a0702f8f (patch) | |
tree | b17bc22ad36ca745ed6aa67df46e1b1e331e9792 /Lib/_strptime.py | |
parent | b1694008127959a7698a82aaa9d3350c8bde1d95 (diff) | |
download | cpython-502b4711f1dc766a93504a1367ddf0c3a0702f8f.tar.gz |
Fix logic error introduced in last commit. Also add a comment to explain what
the code is doing.
Diffstat (limited to 'Lib/_strptime.py')
-rw-r--r-- | Lib/_strptime.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/_strptime.py b/Lib/_strptime.py index aa02ba12c8..90928ffca8 100644 --- a/Lib/_strptime.py +++ b/Lib/_strptime.py @@ -147,11 +147,14 @@ class LocaleTime(object): # strings (e.g., MacOS 9 having timezone as ('','')). if old: current_format = current_format.replace(old, new) + # If %W is used, then Sunday, 2005-01-03 will fall on week 0 since + # 2005-01-03 occurs before the first Monday of the year. Otherwise + # %U is used. time_tuple = time.struct_time((1999,1,3,1,1,1,6,3,0)) if '00' in time.strftime(directive, time_tuple): - U_W = '%U' - else: U_W = '%W' + else: + U_W = '%U' date_time[offset] = current_format.replace('11', U_W) self.LC_date_time = date_time[0] self.LC_date = date_time[1] |