When multiple CustomDateTime properties are present simultaneously (e.g., expiration_time and not_before), the date attribute of the CustomDateTime class retains only the last value.
verification_time = datetime.now(UTC) if timestamp is None else timestamp
if (
self.expiration_time is not None
and verification_time >= self.expiration_time.date
):
raise ExpiredMessage
if self.not_before is not None and verification_time <= self.not_before.date:
raise NotYetValidMessage
The self.expiration_time.date will be identical to self.not_before.date, which is incorrect.
When multiple CustomDateTime properties are present simultaneously (e.g., expiration_time and not_before), the date attribute of the CustomDateTime class retains only the last value.
The
self.expiration_time.date
will be identical toself.not_before.date
, which is incorrect.Here is the reason why this is happening:
date
should be an attribute of the object rather than the class.