mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-29 04:51:11 +00:00
PartialDate: fix __eq__ method
This commit is contained in:
parent
7066e2815b
commit
7fb079cb43
1 changed files with 8 additions and 0 deletions
|
@ -67,6 +67,14 @@ class PartialDate(datetime):
|
||||||
# current_timezone and default_timezone.
|
# current_timezone and default_timezone.
|
||||||
return cls.from_datetime(datetime(year, month, day, tzinfo=_westmost_tz))
|
return cls.from_datetime(datetime(year, month, day, tzinfo=_westmost_tz))
|
||||||
|
|
||||||
|
def __eq__(self, other: object) -> bool:
|
||||||
|
if not isinstance(other, PartialDate):
|
||||||
|
return NotImplemented
|
||||||
|
return self.partial_isoformat() == other.partial_isoformat()
|
||||||
|
|
||||||
|
def __repr__(self) -> str:
|
||||||
|
return f"<{self.__class__.__name__} object: {self.partial_isoformat()}>"
|
||||||
|
|
||||||
|
|
||||||
class MonthParts(PartialDate):
|
class MonthParts(PartialDate):
|
||||||
"""a date bound into month precision"""
|
"""a date bound into month precision"""
|
||||||
|
|
Loading…
Reference in a new issue