Skip to content

Commit 87e0e87

Browse files
authored
Merge branch 'master' into master
2 parents e4e5331 + ae5e7b2 commit 87e0e87

8 files changed

Lines changed: 47 additions & 23 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
changelog:
2020
runs-on: ubuntu-latest
2121
steps:
22+
- uses: actions/checkout@v2
2223
- id: read-version
2324
run: |
24-
echo "::set-output name=VERSION::$(cat ./lib/ice_cube/version.rb | grep VERSION | awk '{ print $3 }' | sed -e 's/\"//g')"
25-
- uses: actions/checkout@v2
26-
- uses: dangoslen/changelog-enforcer@v2.2.0
25+
echo "::set-output name=VERSION::`cat lib/ice_cube/version.rb | grep -i version | awk '{ print $3 }' | sed -e 's/\"//g'`"
26+
- uses: dangoslen/changelog-enforcer@v2.3.1
2727
with:
2828
skipLabels: 'skip-changelog'
2929
expectedLatestVersion: ${{ steps.read-version.outputs.VERSION }}

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
### Added
99
- Indonesian translations. ([#505](https://github.com/seejohnrun/ice_cube/pull/505)) by [@achmiral](https://github.com/achmiral)
1010

11+
### Fixed
12+
- Fix for weekly interval results when requesting `occurrences_between` on a narrow range ([#487](https://github.com/seejohnrun/ice_cube/pull/487)) by [@jakebrady5](https://github.com/jakebrady5)
13+
- When using a rule with hour_of_day validations, and asking for occurrences on the day that DST skips forward, valid occurrences would be missed. ([#464](https://github.com/seejohnrun/ice_cube/pull/464)) by [@jakebrady5](https://github.com/jakebrady5)
14+
1115
## [0.16.4] - 2021-10-21
1216
### Added
1317
- Italian translations
@@ -84,7 +88,7 @@ NOTE: the commit for the _v0.13.0_ release tag incorrectly says _Release 0.13.1_
8488
- Fix whole-day skip with date inputs
8589
- Missed times selected from gap week with weekly interval > 1 ([#241](https://github.com/seejohnrun/ice_cube/pull/241))
8690
- Fix `occurs_on?` miss near midnight for DST ([#245](https://github.com/seejohnrun/ice_cube/pull/245))
87-
91+
8892
## [0.12.1] - 2014-07-04
8993
### Added
9094
- Support for deserialization of times via Time.parse

README.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,17 @@ schedule.previous_occurrence(from_time)
9191
schedule.previous_occurrences(4, from_time)
9292

9393
# or include prior occurrences with a duration overlapping from_time
94-
schedule.next_occurrences(4, from_time, :spans => true)
95-
schedule.occurrences_between(from_time, to_time, :spans => true)
94+
schedule.next_occurrences(4, from_time, spans: true)
95+
schedule.occurrences_between(from_time, to_time, spans: true)
9696

9797
# or give the schedule a duration and ask if occurring_at?
98-
schedule = IceCube::Schedule.new(now, :duration => 3600)
98+
schedule = IceCube::Schedule.new(now, duration: 3600)
9999
schedule.add_recurrence_rule IceCube::Rule.daily
100100
schedule.occurring_at?(now + 1800) # true
101101
schedule.occurring_between?(t1, t2)
102102

103103
# using end_time also sets the duration
104-
schedule = IceCube::Schedule.new(start = Time.now, :end_time => start + 3600)
104+
schedule = IceCube::Schedule.new(start = Time.now, end_time: start + 3600)
105105
schedule.add_recurrence_rule IceCube::Rule.daily
106106
schedule.occurring_at?(start + 3599) # true
107107
schedule.occurring_at?(start + 3600) # false
@@ -162,7 +162,7 @@ ice_cube can provide ical or string representations of individual rules, or the
162162
whole schedule.
163163

164164
```ruby
165-
rule = IceCube::Rule.daily(2).day_of_week(:tuesday => [1, -1], :wednesday => [2])
165+
rule = IceCube::Rule.daily(2).day_of_week(tuesday: [1, -1], wednesday: [2])
166166

167167
rule.to_ical # 'FREQ=DAILY;INTERVAL=2;BYDAY=1TU,-1TU,2WE'
168168

@@ -218,12 +218,12 @@ month (e.g. no occurrences in February for `day_of_month(31)`).
218218

219219
```ruby
220220
# every month on the first and last tuesdays of the month
221-
schedule.add_recurrence_rule IceCube::Rule.monthly.day_of_week(:tuesday => [1, -1])
221+
schedule.add_recurrence_rule IceCube::Rule.monthly.day_of_week(tuesday: [1, -1])
222222

223223
# every other month on the first monday and last tuesday
224224
schedule.add_recurrence_rule IceCube::Rule.monthly(2).day_of_week(
225-
:monday => [1],
226-
:tuesday => [-1]
225+
monday: [1],
226+
tuesday: [-1]
227227
)
228228

229229
# for programmatic convenience (same as above)
@@ -270,7 +270,7 @@ schedule.add_recurrence_rule IceCube::Rule.hourly(2).day(:monday)
270270
schedule.add_recurrence_rule IceCube::Rule.minutely(10)
271271

272272
# every hour and a half, on the last tuesday of the month
273-
schedule.add_recurrence_rule IceCube::Rule.minutely(90).day_of_week(:tuesday => [-1])
273+
schedule.add_recurrence_rule IceCube::Rule.minutely(90).day_of_week(tuesday: [-1])
274274
```
275275

276276
### Secondly (every N seconds)
@@ -298,10 +298,7 @@ https://github.com/GetJobber/recurring_select
298298

299299
## Contributors
300300

301-
* Andrew Vit ([@avit][github-avit])
302-
* Mat Brown - mat@patch.com
303-
* Philip Roberts
304-
* @sakrafd
301+
https://github.com/seejohnrun/ice_cube/graphs/contributors
305302

306303
---
307304

ice_cube.gemspec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ Gem::Specification.new do |s|
88
s.description = "ice_cube is a recurring date library for Ruby. It allows for quick, programatic expansion of recurring date rules."
99
s.author = "John Crepezzi"
1010
s.email = "john@crepezzi.com"
11-
s.homepage = "http://seejohnrun.github.com/ice_cube/"
11+
s.homepage = "https://seejohnrun.github.io/ice_cube/"
1212
s.license = "MIT"
1313

14+
s.metadata["changelog_uri"] = "https://github.com/seejohnrun/ice_cube/blob/master/CHANGELOG.md"
15+
s.metadata["wiki_uri"] = "https://github.com/seejohnrun/ice_cube/wiki"
16+
1417
s.version = IceCube::VERSION
1518
s.platform = Gem::Platform::RUBY
1619
s.files = Dir["lib/**/*.rb", "config/**/*.yml"]

lib/ice_cube/validated_rule.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,8 @@ def other_interval_validations
4646
# to the given start time
4747
def next_time(time, start_time, closing_time)
4848
@time = time
49-
unless @start_time
50-
@start_time = realign(time, start_time)
51-
@time = @start_time if @time < @start_time
52-
end
49+
@start_time ||= realign(time, start_time)
50+
@time = @start_time if @time < @start_time
5351

5452
return nil unless find_acceptable_time_before(closing_time)
5553

lib/ice_cube/validations/hour_of_day.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def realign(opening_time, start_time)
2020
freq = base_interval_validation.interval
2121

2222
first_hour = Array(validations[:hour_of_day]).min_by(&:value)
23-
time = TimeUtil::TimeWrapper.new(start_time, false)
23+
time = TimeUtil::TimeWrapper.new(start_time, true)
2424
if freq > 1 && base_interval_validation.type == :hour
2525
offset = first_hour.validate(opening_time, start_time)
2626
time.add(:hour, offset - freq)

spec/examples/daily_rule_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ module IceCube
5656
Time.local(2013, 3, 11, 2, 0, 0) # -0700
5757
])
5858
end
59+
60+
it "should not skip days where DST changes" do
61+
start_time = Time.local(2013, 3, 10, 0, 0, 0)
62+
schedule = Schedule.new(start_time)
63+
schedule.add_recurrence_rule Rule.daily.hour_of_day(19)
64+
expect(schedule.occurrences_between(start_time, start_time + ONE_DAY)).to eq([
65+
Time.local(2013, 3, 10, 19, 0, 0)
66+
])
67+
end
5968
end
6069

6170
it "should update previous interval" do

spec/examples/weekly_rule_spec.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,19 @@ module IceCube
288288
expect(schedule.next_occurrence(sample[2] - 1)).to eq(sample[2])
289289
end
290290

291+
it "should respect weekly intervals within narrow occurrence ranges" do
292+
start_time = Time.utc(2020, 10, 27, 7, 0, 0)
293+
schedule = Schedule.new(start_time, end_time: start_time + ONE_HOUR)
294+
occurrence_start = Time.utc(2020, 11, 5, 0, 0, 0)
295+
occurrence_end = Time.utc(2020, 11, 5, 23, 59, 59)
296+
297+
schedule.add_recurrence_rule IceCube::Rule.weekly(2).day(:thursday).hour_of_day(13)
298+
schedule.add_recurrence_rule IceCube::Rule.weekly(1).day(:thursday).hour_of_day(12)
299+
expect(schedule.occurrences_between(occurrence_start, occurrence_end)).to eq([
300+
Time.utc(2020, 11, 5, 12, 0, 0)
301+
])
302+
end
303+
291304
it "should align next_occurrence with first valid weekday when schedule starts on a Wednesday" do
292305
t0 = Time.utc(2017, 6, 7)
293306
schedule = IceCube::Schedule.new(t0)

0 commit comments

Comments
 (0)