Add comparison operations to Timestamp.

This commit is contained in:
Sergio Martínez Portela 2021-04-10 11:13:30 +02:00
parent af1e5e6f3d
commit fdc475cb19

View File

@ -568,6 +568,16 @@ class Timestamp:
and (self.repetition == other.repetition)
)
def __lt__(self, other):
if not isinstance(other, Timestamp):
return False
return self.to_datetime() < other.to_datetime()
def __gt__(self, other):
if not isinstance(other, Timestamp):
return False
return self.to_datetime() > other.to_datetime()
def __repr__(self):
return timestamp_to_string(self)