Account for TZ offsets for event durations and next occurrence #499
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.
Summary
Adds a utility function to get the tz offset delta between two dates. Uses the function when calculating the duration of an event and also when we are trying to find the next occurrence.
This fixes
Comments
When a "human" says they want a repeating event from 1a-9a, what they really mean is 1a "local (my) time" to 9a "local (my) time". They would expect the system to handle the DST change and calculate appropriately, they don't really mean "I always want the duration to be 8 hours".
Example
Below is an example script you can use to test with the main branch to see the issue, and then you can test with this branch to see that is fixed. I've also left the results here so you can easily see.
The script
Results for "fall back" case
The current behavior (seejohnrun/ice_cube#main)
The expected behavior (PagerTree/ice_cube#main)
Results for "spring forward" case
The current behavior (seejohnrun/ice_cube#main)
The expected behavior (PagerTree/ice_cube#main)