@@ -306,22 +306,23 @@ class TimeRE(dict):
306
306
307
307
def __init__ (self , locale_time = LocaleTime ()):
308
308
"""Init inst with non-locale regexes and store LocaleTime object."""
309
- # XXX: should 0 be valid for:
310
- # day (d), julian day (j), month (m), and hour12 (I)?
311
- super ( TimeRE , self ) .__init__ ({
309
+ #XXX: Does 'Y' need to worry about having less or more than 4 digits?
310
+ base = super ( TimeRE , self )
311
+ base .__init__ ({
312
312
# The " \d" option is to make %c from ANSI C work
313
- 'd' : r"(?P<d>3[0-1]|[0 -2]\d|\d| \d )" ,
313
+ 'd' : r"(?P<d>3[0-1]|[1 -2]\d|0[1-9]|[1-9]| [1-9] )" ,
314
314
'H' : r"(?P<H>2[0-3]|[0-1]\d|\d)" ,
315
- 'I' : r"(?P<I>0\d| 1[0-2]|\d )" ,
316
- 'j' : r"(?P<j>(?:3 [0-5]\d|36 [0-6])|[0 -2]\d\d|\d\d|\d )" ,
317
- 'm' : r"(?P<m>0\d| 1[0-2]|\d )" ,
315
+ 'I' : r"(?P<I>1[0-2]|0[1-9]|[1-9] )" ,
316
+ 'j' : r"(?P<j>36 [0-6]|3 [0-5]\d|[1 -2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9] )" ,
317
+ 'm' : r"(?P<m>1[0-2]|0[1-9]|[1-9] )" ,
318
318
'M' : r"(?P<M>[0-5]\d|\d)" ,
319
319
'S' : r"(?P<S>6[0-1]|[0-5]\d|\d)" ,
320
320
'U' : r"(?P<U>5[0-3]|[0-4]\d|\d)" ,
321
321
'w' : r"(?P<w>[0-6])" ,
322
- 'W' : r"(?P<W>5[0-3]|[0-4]\d|\d)" , # Same as U
322
+ # W is set below by using 'U'
323
323
'y' : r"(?P<y>\d\d)" ,
324
324
'Y' : r"(?P<Y>\d\d\d\d)" })
325
+ base .__setitem__ ('W' , base .__getitem__ ('U' ))
325
326
self .locale_time = locale_time
326
327
327
328
def __getitem__ (self , fetch ):
0 commit comments