DateType

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. (by glyph)

DateType Alternatives

Similar projects and alternatives to DateType

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better DateType alternative or higher similarity.

DateType reviews and mentions

Posts with mentions or reviews of DateType. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-11-19.
  • It's Time for a Change: Datetime.utcnow() Is Now Deprecated
    5 projects | news.ycombinator.com | 19 Nov 2023
    It's funny you should say this.

    Reading this article prompted me to future-proof a program I maintain for fun that deals with time; it had one use of utcnow, which I fixed.

    And then I tripped over a runtime type problem in an unrelated area of the code, despite the code being green under "mypy --strict". (and "100% coverage" from tests, except this particular exception only occured in a "# pragma: no-cover" codepath so it wasn't actually covered)

    It turns out that because of some core decisions about how datetime objects work, `datetime.date.today() < datetime.datetime.now()` type-checks but gives a TypeError at runtime. Oops. (cause discussed at length in https://github.com/python/mypy/issues/9015 but without action for 3 years)

    One solution is apparently to use `datetype` for type annotations (while continuing to use `datetime` objects at runtime): https://github.com/glyph/DateType

  • DateType: Distinguish aware and native datetimes at the type level
    1 project | news.ycombinator.com | 18 Nov 2023

Stats

Basic DateType repo stats
2
63
7.7
2 months ago

glyph/DateType is an open source project licensed under GNU General Public License v3.0 or later which is an OSI approved license.

The primary programming language of DateType is Python.


Sponsored
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com