[dt] update representation of invalid datetime objects

This commit is contained in:
Mike Fährmann
2025-10-19 18:51:42 +02:00
parent 989136bc59
commit 5802107cdf
2 changed files with 8 additions and 2 deletions

View File

@@ -18,8 +18,14 @@ class NullDatetime(datetime):
def __bool__(self):
return False
def __str__(self):
return "[Invalid DateTime]"
NONE = NullDatetime(101, 1, 1)
def __format__(self, format_spec):
return f"[Invalid DateTime {format_spec}]"
NONE = NullDatetime(1, 1, 1)
EPOCH = datetime(1970, 1, 1)
SECOND = timedelta(0, 1)