nominaldelta

nominal difference of date/datetime
git clone https://git.ce9e.org/nominaldelta.git

commit
7ee0200344cc546271b84cad9e71c20578b0d795
parent
a63e86b0ac78c5e216017682fa69eeabb07b352a
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-08-31 08:27
implement hash and bool

Diffstat

M nominaldelta.py 6 ++++++

1 files changed, 6 insertions, 0 deletions


diff --git a/nominaldelta.py b/nominaldelta.py

@@ -87,6 +87,12 @@ class NominalDelta:
   87    87             f'seconds={self.seconds})'
   88    88         )
   89    89 
   -1    90     def __hash__(self):
   -1    91         return hash((self.months, self.days, self.seconds))
   -1    92 
   -1    93     def __bool__(self):
   -1    94         return bool(self.months or self.days or self.seconds)
   -1    95 
   90    96     def __eq__(self, other: Self) -> Self:
   91    97         if isinstance(other, NominalDelta):
   92    98             return (