diff --git a/pytimeparse/timeparse.py b/pytimeparse/timeparse.py index 3be5a22..cd52ffd 100644 --- a/pytimeparse/timeparse.py +++ b/pytimeparse/timeparse.py @@ -34,8 +34,8 @@ import re SIGN = r'(?P[+|-])?' -#YEARS = r'(?P\d+)\s*(?:ys?|yrs?.?|years?)' -#MONTHS = r'(?P\d+)\s*(?:mos?.?|mths?.?|months?)' +YEARS = r'(?P\d+)\s*(?:ys?|yrs?.?|years?)' +MONTHS = r'(?P\d+)\s*(?:mos?.?|mths?.?|months?)' WEEKS = r'(?P[\d.]+)\s*(?:w|wks?|weeks?)' DAYS = r'(?P[\d.]+)\s*(?:d|dys?|days?)' HOURS = r'(?P[\d.]+)\s*(?:h|hrs?|hours?)' @@ -54,8 +54,8 @@ TIMEFORMATS = [ r'{WEEKS}\s*{DAYS}\s*{HOURS}\s*{MINS}\s*{SECS}'.format( - #YEARS=OPTSEP(YEARS), - #MONTHS=OPTSEP(MONTHS), + YEARS=OPTSEP(YEARS), + MONTHS=OPTSEP(MONTHS), WEEKS=OPTSEP(WEEKS), DAYS=OPTSEP(DAYS), HOURS=OPTSEP(HOURS), @@ -71,10 +71,10 @@ DAYCLOCK=DAYCLOCK), r'{SECCLOCK}'.format( SECCLOCK=SECCLOCK), - #r'{YEARS}'.format( - #YEARS=YEARS), - #r'{MONTHS}'.format( - #MONTHS=MONTHS), + r'{YEARS}'.format( + YEARS=YEARS), + r'{MONTHS}'.format( + MONTHS=MONTHS), ] COMPILED_SIGN = re.compile(r'\s*' + SIGN + r'\s*(?P.*)$') @@ -82,8 +82,8 @@ for timefmt in TIMEFORMATS] MULTIPLIERS = dict([ - #('years', 60 * 60 * 24 * 365), - #('months', 60 * 60 * 24 * 30), + ('years', 60 * 60 * 24 * 365), + ('months', 60 * 60 * 24 * 30), ('weeks', 60 * 60 * 24 * 7), ('days', 60 * 60 * 24), ('hours', 60 * 60), @@ -106,8 +106,8 @@ def _interpret_as_minutes(sval, mdict): and (('hours' not in mdict) or (mdict['hours'] is None)) and (('days' not in mdict) or (mdict['days'] is None)) and (('weeks' not in mdict) or (mdict['weeks'] is None)) - #and (('months' not in mdict) or (mdict['months'] is None)) - #and (('years' not in mdict) or (mdict['years'] is None)) + and (('months' not in mdict) or (mdict['months'] is None)) + and (('years' not in mdict) or (mdict['years'] is None)) ): mdict['hours'] = mdict['mins'] mdict['mins'] = mdict['secs']