Skip to content

Support timezone-aware datetime objects #178

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

butson
Copy link
Contributor

@butson butson commented Apr 25, 2025

connection:

  • Added support for explicit TimeZone connection property

datatype:

  • Use Julian calendar for date/datetime before 1582 Oct 4. When the Gregorian calendar was introduced: . The day after October 4, 1582 (Julian) became October 15, 1582 (Gregorian). . That 10-day jump is not accounted for in C's calendar logic. . Julian calendar handles leap years differently. The utc calendar the engine is using understands this the python functions based on C calendar logic do not.
  • time.mktime , time.localtime don't support older dates while engine does changing to use calendar above and calculate time, avoid these issues.
  • use of datetime + timezone should handle daylight savings times and not be off by an hour.

tests:

  • Use connection property TimeZone to change timezone
  • Support timezone-aware datetime
  • Use pytz correctly with localize if pytz is used
  • Use zoneinfo.ZoneInfo if available

encodedsession:

  • Manage and verify TimeZone settings on per connection basis
  • Allows connections with different TimeZone setting from same application

requirements.txt:

  • Add requirement for tzlocal, should be available on all supported python versions. There is a change in api between releases , this is handled in the code.

connection:
- Added support for explicit TimeZone connection property

datatype:
- Use Julian calendar for date/datetime before 1582 Oct 4.
  When the Gregorian calendar was introduced:
  .  The day after October 4, 1582 (Julian) became October 15, 1582 (Gregorian).
  .  That 10-day jump is not accounted for in C's calendar logic.
  .  Julian calendar handles leap years differently.
  The utc calendar the engine is using understands this the python functions
  based on C calendar logic do not.
- time.mktime , time.localtime don't support older dates while engine does
  changing to use calendar above and calculate time, avoid these issues.
- use of datetime + timezone should handle daylight savings times and not
  be off by an hour.

tests:
-  Use connection property TimeZone to change timezone
-  Support timezone-aware datetime
-  Use pytz correctly with localize if pytz is used
-  Use zoneinfo.ZoneInfo if available

encodedsession:
-  Manage and verify TimeZone settings on per connection basis
-  Allows connections with different TimeZone setting from same
   application

requirements.txt:
-  Add requirement for tzlocal, should be available on all
   supported python versions.  There is a change in
   api between releases , this is handled in the code.
@butson butson requested a review from madscientist April 25, 2025 16:52
@butson
Copy link
Contributor Author

butson commented Apr 28, 2025

I expect the cursor test failure is related to the callback to engine to get the real time zone used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant