-
Notifications
You must be signed in to change notification settings - Fork 43
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
georgiy-belyanin
wants to merge
1
commit into
tarantool:latest
Choose a base branch
from
georgiy-belyanin:datetime-fix-timezone-handling
base: latest
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Update datetime timezone handling after the fix #4720
georgiy-belyanin
wants to merge
1
commit into
tarantool:latest
from
georgiy-belyanin:datetime-fix-timezone-handling
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
changed the title
Update datetime timezone handling after fix
Update datetime timezone handling after the fix
Dec 24, 2024
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 setting timezone only changes the local time of day represented by the datetime object instead of affecting the timestamp. PR tarantool/tarantool#10970 Issue tarantool/tarantool#10363
georgiy-belyanin
force-pushed
the
datetime-fix-timezone-handling
branch
from
December 25, 2024 11:36
122bd53
to
80bad26
Compare
georgiy-belyanin
added a commit
to georgiy-belyanin/tarantool
that referenced
this pull request
Dec 25, 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
added a commit
to georgiy-belyanin/tarantool
that referenced
this pull request
Jan 31, 2025
This patch adds a fix making `datetime` handle `tz` or `tzoffset` parameters properly. Previously, changing a timezone altered the timestamp value but preserved the time of day. Now you may enable new behavior making specifying a timezone preserve the timestamp and update the represented time of day. This behavior could be achieved by setting a new compat option `datetime_apply_timezone_action` to `'new'`. The option is going to be enabled by default in 4.x. Enabling new behavior involves the following. 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
added a commit
to georgiy-belyanin/tarantool
that referenced
this pull request
Jan 31, 2025
This patch adds a fix making `datetime` handle `tz` and `tzoffset` parameters properly. Previously, changing a timezone altered the timestamp value but preserved the time of day. Now you may enable new behavior making specifying a timezone preserve the timestamp and update the represented time of day. This behavior could be achieved by setting a new compat option `datetime_apply_timezone_action` to `'new'`. The option is going to be enabled by default in 4.x. Enabling new behavior involves the following. 1. Creating a datetime object with non-empty `tz`/`tzoffset` and `timestamp` values results with a time of day 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch fixes Tarantool output on using
datetime.new()
anddatetime.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 setting timezone only changes the local time of day represented by the datetime object instead of affecting the timestamp.
PR tarantool/tarantool#10970
Issue tarantool/tarantool#10363