This repository has been archived by the owner on Feb 18, 2024. It is now read-only.
Added support to add an interval to a timestamp #417
Merged
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 adds support for adding an interval to a timestamp with timezone, thus taking leap days (Feb 29th) and leap hours (daylight saving) into account.
This brings the last missing piece to fully support timestamps with timezones: we can now convert them from and to strings, and perform basic interval arithmetic taking the timezone into account.
3 examples:
2020-03-29 00:00:00 WET
results in2020-03-29 02:00:00 WEST
2020-03-29 00:00:00 WET
results in2020-10-29 01:00:00 WET
the former crosses one summer time shift (and thus adds an extra hour), the latter crosses both (and thus adds no extra hour).
1972-02-28 01:00:00 +01:00
results in1972-02-29 02:01:00 +01:00
because 1972 has a leap year.
When the timestamp has no timezone information, days are
24 * 60 * 60
.Closes #23