Added the VERY_START constant in Period.Parser to denote the earliest-possible beginning in the Mia core application.
This commit is contained in:
parent
ad52aa1783
commit
95cd08a887
@ -415,6 +415,8 @@ class Period:
|
|||||||
error (str): The period specification format error, or
|
error (str): The period specification format error, or
|
||||||
None on success.
|
None on success.
|
||||||
"""
|
"""
|
||||||
|
VERY_START = datetime.date(1990, 1, 1)
|
||||||
|
|
||||||
def __init__(self, spec):
|
def __init__(self, spec):
|
||||||
self.spec = None
|
self.spec = None
|
||||||
self.start = None
|
self.start = None
|
||||||
@ -463,7 +465,7 @@ class Period:
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
self.invalid_period()
|
self.invalid_period()
|
||||||
return
|
return
|
||||||
self.start = datetime.date(2000, 1, 1)
|
self.start = Period.Parser.VERY_START
|
||||||
self.end = self._month_last_day(until_month)
|
self.end = self._month_last_day(until_month)
|
||||||
self.description = gettext("Until %s")\
|
self.description = gettext("Until %s")\
|
||||||
% self._month_text(year, month)
|
% self._month_text(year, month)
|
||||||
@ -489,13 +491,13 @@ class Period:
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
self.invalid_period()
|
self.invalid_period()
|
||||||
return
|
return
|
||||||
self.start = datetime.date(2000, 1, 1)
|
self.start = Period.Parser.VERY_START
|
||||||
self.description = gettext("Until %s")\
|
self.description = gettext("Until %s")\
|
||||||
% self._year_text(year)
|
% self._year_text(year)
|
||||||
return
|
return
|
||||||
# All time
|
# All time
|
||||||
if spec == "-":
|
if spec == "-":
|
||||||
self.start = datetime.date(2000, 1, 1)
|
self.start = Period.Parser.VERY_START
|
||||||
self.end = self._month_last_day(timezone.localdate())
|
self.end = self._month_last_day(timezone.localdate())
|
||||||
self.description = gettext("All")
|
self.description = gettext("All")
|
||||||
return
|
return
|
||||||
@ -573,7 +575,7 @@ class Period:
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
self.invalid_period()
|
self.invalid_period()
|
||||||
return
|
return
|
||||||
self.start = datetime.date(2000, 1, 1)
|
self.start = Period.Parser.VERY_START
|
||||||
self.description = gettext("Until %s")\
|
self.description = gettext("Until %s")\
|
||||||
% self._date_text(self.end)
|
% self._date_text(self.end)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user