X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=plomtask%2Fdays.py;h=5e975602d112a81f71b7bafb47b2939f9084d365;hb=9e297373770305a915dbe987bf6fda02db704ec6;hp=8dd384349bd1419a16b19971ee4d9aa81deff796;hpb=49edaa072a3574f2303828e62c6a72f0d0bcec2c;p=plomtask diff --git a/plomtask/days.py b/plomtask/days.py index 8dd3843..5e97560 100644 --- a/plomtask/days.py +++ b/plomtask/days.py @@ -78,6 +78,17 @@ class Day(BaseModel[str]): assert isinstance(self.id_, str) return self.id_ + @property + def first_of_month(self) -> bool: + """Return what month self.date is part of.""" + assert isinstance(self.id_, str) + return self.id_[-2:] == '01' + + @property + def month_name(self) -> str: + """Return what month self.date is part of.""" + return self.datetime.strftime('%B') + @property def weekday(self) -> str: """Return what weekday matches self.date.""" @@ -94,7 +105,3 @@ class Day(BaseModel[str]): """Return date succeeding date of this Day.""" next_datetime = self.datetime + timedelta(days=1) return next_datetime.strftime(DATE_FORMAT) - - def save(self, db_conn: DatabaseConnection) -> None: - """Add (or re-write) self to DB and cache.""" - self.save_core(db_conn)