Thanks to visit codestin.com
Credit goes to github.com

Skip to content

using aware datetime #105

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

Closed
bakhterets opened this issue Mar 18, 2024 · 1 comment
Closed

using aware datetime #105

bakhterets opened this issue Mar 18, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@bakhterets
Copy link
Contributor

Reason

We use naive datetime, but from "#101" began to add a time zone in the interface.
Better to use aware datetime in the future

Additional information:

Python 3.12:
datetime.datetime’s utcnow() and utcfromtimestamp() are deprecated and will be removed in a future version.

Changes:
Changed all datetime objects and related methods to use the UTC time zone.

@bakhterets
Copy link
Contributor Author

The concept:

  • storing timestamps with UTC timezone by default
  • processing time objects on the frontend

@bakhterets bakhterets mentioned this issue May 28, 2024
otc-zuul bot pushed a commit that referenced this issue Jun 17, 2024
issue_105

#105
Problem:
datetime: datetime.datetime’s utcnow() and utcfromtimestamp() are deprecated and will be removed in a future version. Instead, use timezone-aware objects to represent datetimes in UTC: respectively, call now() and fromtimestamp() with the tz parameter set to datetime.UTC. (Contributed by Paul Ganssle in gh-103857.)
Solution:
To add new function to get actual datetime_now with timezone and remove timezone to save the datebase models unchanged (to use postgresql and sqlite).
Conclusion:
All timestamps converts to utc timezone and stores without timezone in the database

Reviewed-by: Aloento
Reviewed-by: Vladimir Hasko <[email protected]>
Reviewed-by: Ilia Bakhterev
@bakhterets bakhterets added the enhancement New feature or request label Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant