[Bugfix] Fix the month name printed by the main module

This commit is contained in:
Gergely Polonkai 2021-11-19 08:44:56 +01:00
parent 57086bf959
commit b1e8c768be
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
1 changed files with 16 additions and 6 deletions

View File

@ -202,6 +202,9 @@ class MinariDateTime:
@property @property
def minari_day(self): def minari_day(self):
"""Return the current Minari calendar day
"""
if not self._calculated: if not self._calculated:
self._calculate_minari_parts() self._calculate_minari_parts()
@ -209,20 +212,27 @@ class MinariDateTime:
@property @property
def minari_special(self): def minari_special(self):
"""Return the name of the current special day, if any
"""
if not self._calculated: if not self._calculated:
self._calculate_minari_parts() self._calculate_minari_parts()
return self._special_day return self._special_day
def __str__(self): def __str__(self):
output = f'{self.minari_year} ' output = f'{self.minari_year} '
if self._special_day is not None: if self.minari_special is not None:
output += self.SPECIAL_NAMES[self._special_day] output += self.SPECIAL_NAMES[self.minari_special]
else: else:
month_name = self.MONTH_NAMES[self._minari_month] weekday = self._minari_weekday - 1
weekday_name = self.DAY_NAMES[self._minari_weekday]
output += f'{month_name} {self._minari_day} ({weekday_name})' if weekday == -1:
weekday = 5
month_name = self.MONTH_NAMES[self.minari_month - 1]
weekday_name = self.DAY_NAMES[weekday]
output += f'{month_name} {self.minari_day} ({weekday_name})'
return output return output