Renamed get_month_last_day() to _month_last_day() in Period.Parser in the Mia core application.

This commit is contained in:
依瑪貓 2020-08-03 21:30:40 +08:00
parent 4cd0f0636d
commit 2ff813ebd1

View File

@ -436,7 +436,7 @@ class Period:
except ValueError: except ValueError:
self.invalid_period() self.invalid_period()
return return
self.end = self.get_month_last_day(self.start) self.end = self._month_last_day(self.start)
self.description = self._month_text(year, month) self.description = self._month_text(year, month)
return return
# From a specific month # From a specific month
@ -449,8 +449,7 @@ class Period:
except ValueError: except ValueError:
self.invalid_period() self.invalid_period()
return return
self.end = self.get_month_last_day( self.end = self._month_last_day(timezone.localdate())
timezone.localdate())
self.description = gettext("Since %s")\ self.description = gettext("Since %s")\
% self._month_text(year, month) % self._month_text(year, month)
return return
@ -465,7 +464,7 @@ class Period:
self.invalid_period() self.invalid_period()
return return
self.start = datetime.date(2000, 1, 1) self.start = datetime.date(2000, 1, 1)
self.end = self.get_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)
return return
@ -497,8 +496,7 @@ class Period:
# All time # All time
if spec == "-": if spec == "-":
self.start = datetime.date(2000, 1, 1) self.start = datetime.date(2000, 1, 1)
self.end = self.get_month_last_day( self.end = self._month_last_day(timezone.localdate())
timezone.localdate())
self.description = gettext("All") self.description = gettext("All")
return return
# A specific date # A specific date
@ -587,7 +585,7 @@ class Period:
today = timezone.localdate() today = timezone.localdate()
self.spec = dateformat.format(today, "Y-m") self.spec = dateformat.format(today, "Y-m")
self.start = datetime.date(today.year, today.month, 1) self.start = datetime.date(today.year, today.month, 1)
self.end = self.get_month_last_day(self.start) self.end = self._month_last_day(self.start)
self.description = gettext("This Month") self.description = gettext("This Month")
def invalid_period(self): def invalid_period(self):
@ -598,7 +596,7 @@ class Period:
self.set_this_month() self.set_this_month()
@staticmethod @staticmethod
def get_month_last_day(day): def _month_last_day(day):
"""Calculates and returns the last day of a month. """Calculates and returns the last day of a month.
Args: Args: