Skip to content
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

Update datetime timezone handling after the fix #4720

Draft
wants to merge 1 commit into
base: latest
Choose a base branch
from

Conversation

georgiy-belyanin
Copy link
Member

This patch fixes Tarantool output on using datetime.new() and datetime.set() with timezones specified.

After tarantool/tarantool#10970 datetime objects created/modified with timestamps plus timezones are handled differently from the way they are described in the doc. Now specifying a timezone only changes the displayed time instead of affecting the timestamp representing the time passed from 1970-01-01. Thus, setting a new timezone properly affects hours/minutes.

PR tarantool/tarantool#10970
Issue tarantool/tarantool#10363

This patch fixes Tarantool output on using `datetime.new()` and
`datetime.set()` with timezones specified.

After tarantool/tarantool#10970 datetime objects created/modified with
timestamps plus timezones are handled differently from the way they are
described in the doc. Now specifying a timezone only changes the
displayed time instead of affecting the timestamp representing the time
passed from 1970-01-01. Thus, setting a new timezone properly affects
hours/minutes.

PR tarantool/tarantool#10970
Issue tarantool/tarantool#10363
georgiy-belyanin added a commit to georgiy-belyanin/tarantool that referenced this pull request Dec 24, 2024
This patch makes `datetime` handle specified `tz` or `tzoffset`
properly. It means timezones are now only affect the way datetime
objects are formatted instead of timestamp value they represent.

The patch involves this changes in the behavior:
1. Creating/setting a `timestamp` value with `tz`/`tzoffset` results
   with a day time corresponding to the timestamp value plus the
   timezone offset. E.g if we create a datetime object with a timestamp
   corresponding to 9:12 o'clock in `+0000` timezone and set
   `tzoffset = -60` the resulting timestamp will represent 8:12 o'clock.
2. Setting a new `tz`/`tzoffset` affects the time of day represented by
   the datetime. E.g. if you update a datetime object of 11:12 o'clock
   having `tzoffset = 180` with `tzoffset = 120` the resulting datetime
   object will represent 10:12.

Closes tarantool#10363

NO_DOC=will be in tarantool/doc#4720
@georgiy-belyanin georgiy-belyanin changed the title Update datetime timezone handling after fix Update datetime timezone handling after the fix Dec 24, 2024
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