A type wrapper for the standard library `datetime` that supplies stricter checks, such as making 'datetime' not substitutable for 'date', and separating out Naive and Aware datetimes into separate, mutually-incompatible types.
Last updated Jun 2, 2026
96
Stars
10
Forks
2
Issues
0
Stars/day
Attention Score
27
Language breakdown
Python 100.0%
โธ Files
click to expand
README
DateType
A Workaround
DateType is a workaround for two bugs to demonstrate that we could have a type-checking-time wrapper for datetime that doesn't change (or almost doesn't change) the implementation, but fixes up two very annoying behaviors of the stdlib datetime module:
- a
datetimenow won't type-check as adate- it still inherits at runtime
- there are separate types for naive and aware
datetimes.
@classmethods for
construction on the Naive and Aware types, and a few functions that do
runtime checks to convert to/from stdlib types).๐ More in this category