Added the is_a_month property to the Period utility.
This commit is contained in:
parent
41770e38b8
commit
b0a4a735f3
@ -63,6 +63,8 @@ class Period:
|
|||||||
"""The period specification."""
|
"""The period specification."""
|
||||||
self.desc: str = ""
|
self.desc: str = ""
|
||||||
"""The text description."""
|
"""The text description."""
|
||||||
|
self.is_a_month: bool = False
|
||||||
|
"""Whether the period is a whole month."""
|
||||||
self.is_type_month: bool = False
|
self.is_type_month: bool = False
|
||||||
"""Whether the period is for the month chooser."""
|
"""Whether the period is for the month chooser."""
|
||||||
self.is_a_year: bool = False
|
self.is_a_year: bool = False
|
||||||
@ -89,8 +91,9 @@ class Period:
|
|||||||
self.desc = self.__get_desc()
|
self.desc = self.__get_desc()
|
||||||
if self.start is None or self.end is None:
|
if self.start is None or self.end is None:
|
||||||
return
|
return
|
||||||
self.is_type_month \
|
self.is_a_month = self.start.day == 1 \
|
||||||
= self.start.day == 1 and self.end == _month_end(self.start)
|
and self.end == _month_end(self.start)
|
||||||
|
self.is_type_month = self.is_a_month
|
||||||
self.is_a_year = self.start == datetime.date(self.start.year, 1, 1) \
|
self.is_a_year = self.start == datetime.date(self.start.year, 1, 1) \
|
||||||
and self.end == datetime.date(self.start.year, 12, 31)
|
and self.end == datetime.date(self.start.year, 12, 31)
|
||||||
self.is_a_day = self.start == self.end
|
self.is_a_day = self.start == self.end
|
||||||
|
Loading…
Reference in New Issue
Block a user