-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Summary
Currently, the docs says:
Python datetime objects can be naive or timezone-aware. While an aware object represents a specific moment in time, a naive object does not contain enough information to unambiguously locate itself relative to other datetime objects. Since this can lead to errors, it is recommended to always use timezone-aware objects.
datetime.date.today returns a naive datetime object. Instead, use datetime.datetime.now(tz=...).date() to create a timezone-aware object.
This is mentioning datetime objects multiple times, but this rule is about date objects. date objects can never be tz-aware (and are also not considered naïve, because that concept makes no sense for them). Overall I find the rule problematic conceptually, but the documentation should at least be accurate and don't mention datetime objects, or at least mention them in relation to date objects.
Version
No response