-
Notifications
You must be signed in to change notification settings - Fork 358
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
weekly rule DST issue #551
Open
larskuhnt
wants to merge
8
commits into
ice-cube-ruby:master
Choose a base branch
from
Promptus:weekly_dst_issue
base: master
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.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
9952238
added specs for weekly DST issue
larskuhnt 30a2eb3
use timezoneless time for weekly rule realigns
larskuhnt c7c1970
fixed some lint issues
larskuhnt b6bad31
updated changelog
larskuhnt 0df29bc
review fixes and added comments
larskuhnt d6b49d2
realign time to the correct hour during DST changes
larskuhnt ed28691
Merge remote-tracking branch 'upstream/master' into weekly_dst_issue
larskuhnt 2c15676
lint updates
larskuhnt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require "spec_helper" | ||
|
||
RSpec.describe IceCube::Validations::HourOfDay::Validation do | ||
describe :validate do | ||
let(:timezone) { "Africa/Cairo" } | ||
let(:time) { "2024-05-03 00:20:00" } | ||
let(:time_in_zone) { ActiveSupport::TimeZone[timezone].parse(time) } | ||
let(:start_time) { ActiveSupport::TimeZone[timezone].parse("2024-04-26 01:20:00") } | ||
|
||
let(:validation) { IceCube::Validations::HourOfDay::Validation.new(nil) } | ||
|
||
it "returns the correct offset for the same hour" do | ||
expect(validation.validate(time_in_zone, start_time)).to eq 1 | ||
end | ||
end | ||
end |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add some tests to cover the edge case you've described.
Also, what happens if the threshold for DST isn't
-1
days back?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case can only happen when the realigned time changed the hour in the internals of
Time
because of a DST change, so -1 day will always be a time which does not fall into the DST change time imho.I also see that this is not the ideal solution, it would be better to somehow "fix" the hour to the start time hour of the schedule somewhere in
ValidatedRule#next_time
but I did not find a way to access the start time of the schedule inValidatedRule
. Maybe you have an idea to that approach.Regarding the edge case: that was just a guess based on the documentation for the message. I don't really understand the described edge case and thought that the movement to the previous day could somehow trigger that case again.