-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DTZ003
and DTZ004
docs
#6223
Conversation
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinux
Windows
|
/// `datetime` objects are "naive" by default, in that they do not include | ||
/// timezone information. "Naive" objects are easy to understand, but ignore | ||
/// some aspects of reality, which can lead to subtle bugs. Timezone-aware | ||
/// `datetime` objects are preferred, as they represent a specific moment in | ||
/// time, unlike "naive" objects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for contributing this!
I find this section a little vague and hard to read. Are there some resources we can use for more specific content here? It'd be nice to avoid using "naive" repeatedly as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback!
Sure, what do you think of this? For consistency, I was hoping to just re-use the same explanation on each DTZ
issue - let me know if that's okay too and I can update the rest.
Python datetime objects can be naive or timezone-aware. 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 which can lead to errors. It is recommended to always use timezone-aware objects. See https://docs.python.org/3/library/datetime.html#aware-and-naive-objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zanieb Let me know what you think, I've updated DTZ003 and DTZ004 with the updated wording.
Changes: - Fixes typo and repeated phrase in `DTZ002` - Adds docs for `DTZ003` - Adds docs for `DTZ004` - Adds example for <=Python3.10 in `DTZ001` Related to: astral-sh#2646
Changes:
DTZ002
DTZ003
DTZ004
DTZ001
Related to: #2646