@@ -562,7 +562,7 @@ class Period(object):
562
562
('%Y-%m-%dT%H:%M' , '%Y-%m-%d %H:%M' ), # minute
563
563
('%Y-%m-%dT%H:%M:%S' , '%Y-%m-%d %H:%M:%S' ) # second
564
564
)
565
- relative = {'y' : 365 , 'm' : 30 , 'w' : 7 , 'd' : 1 }
565
+ relative_units = {'y' : 365 , 'm' : 30 , 'w' : 7 , 'd' : 1 }
566
566
relative_re = '(?P<sign>[+|-]?)(?P<quantity>[0-9]+)' + \
567
567
'(?P<timespan>[y|m|w|d])'
568
568
@@ -618,10 +618,10 @@ def find_date_and_format(string):
618
618
# Add or subtract the given amount of time from the current
619
619
# date.
620
620
multiplier = - 1 if sign == '-' else 1
621
- days = cls .relative [timespan ]
621
+ days = cls .relative_units [timespan ]
622
622
date = datetime .now () + \
623
623
timedelta (days = int (quantity ) * days ) * multiplier
624
- string = date . strftime ( cls .date_formats [ 5 ][ 0 ])
624
+ return cls ( date , cls .precisions [ 5 ])
625
625
626
626
# Check for an absolute date.
627
627
date , ordinal = find_date_and_format (string )
@@ -637,8 +637,6 @@ def open_right_endpoint(self):
637
637
"""
638
638
precision = self .precision
639
639
date = self .date
640
- if 'relative' == self .precision :
641
- return date
642
640
if 'year' == self .precision :
643
641
return date .replace (year = date .year + 1 , month = 1 )
644
642
elif 'month' == precision :
0 commit comments