From b1e8c768bef6568f60c2e1eae1dd9037845b1ef2 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 19 Nov 2021 08:44:56 +0100 Subject: [PATCH] [Bugfix] Fix the month name printed by the main module --- minari_date/__init__.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/minari_date/__init__.py b/minari_date/__init__.py index 1c26ea5..5c70ab8 100644 --- a/minari_date/__init__.py +++ b/minari_date/__init__.py @@ -202,6 +202,9 @@ class MinariDateTime: @property def minari_day(self): + """Return the current Minari calendar day + """ + if not self._calculated: self._calculate_minari_parts() @@ -209,20 +212,27 @@ class MinariDateTime: @property def minari_special(self): + """Return the name of the current special day, if any + """ + if not self._calculated: self._calculate_minari_parts() - return self._special_day def __str__(self): output = f'{self.minari_year} ' - if self._special_day is not None: - output += self.SPECIAL_NAMES[self._special_day] + if self.minari_special is not None: + output += self.SPECIAL_NAMES[self.minari_special] else: - month_name = self.MONTH_NAMES[self._minari_month] - weekday_name = self.DAY_NAMES[self._minari_weekday] - output += f'{month_name} {self._minari_day} ({weekday_name})' + weekday = self._minari_weekday - 1 + + 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