Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

bug in occurs_on? #95

Closed
thoughtafter opened this Issue Aug 15, 2012 · 6 comments

Comments

Projects
None yet
4 participants

I was trying to test if ice_cube would fit my needs for a project. Quickly ran into this bug (unless I am doing something wrong). Creating a schedule for 6pm today in the local time zone (PDT) and then testing if it occurs_on? today. Apparently it doesn't.

irb(main)> d = Date.today
=> Tue, 14 Aug 2012
irb(main)> t = Time.new(d.year, d.month, d.day, 18)
=> 2012-08-14 18:00:00 -0700
irb(main)> s = IceCube::Schedule.new(t)
=> 
irb(main)> s.add_recurrence_rule IceCube::Rule.daily
=> [Daily]
irb(main)> s.first(1)
=> [2012-08-14 18:00:00 -0700]
irb(main)> s.occurs_on?(d)
=> false
irb(main)> s.occurs_on?(t)
=> true
irb(main)> s.occurs_on?(d.to_time)
=> true

Yup, have the same problem. What I ended up doing is create a module that converts everything to time for me. Have some other such issues where I need to check if the next_occurence(Date.yesterday.to_time) to get todays occurrences.

aroc commented Oct 7, 2012

@thoughtafter @mhenrixon Weird, works fine for me with that exact example.

Collaborator

avit commented Dec 2, 2012

There were some time zone bugs, so testing might be dependent on your system clock & specific examples for midnight boundaries.

Please try the fix I posted in #115

avit added a commit to avit/ice_cube that referenced this issue Dec 21, 2012

Ensure correct dates for different kinds of Time
Refactored & tightened specs for Schedule#occurs_on? edge cases.

Fixes #57 and #95.

Nice!! Thanks @avit could you release a new version soon? Been dying to fix all the hacks we currently have in our app.

Collaborator

avit commented Dec 21, 2012

I have a few bug fixes lined up and we'll coordinate a release for 0.9.3 soon. Meanwhile, if you want to point your Gemfile to test against the master branch here, I'd like that.

@avit avit closed this Dec 21, 2012

Just tested with 0.9.3 and this seems resolved. Thank you.

rlivsey added a commit to rlivsey/ice_cube that referenced this issue Jun 18, 2013

Ensure correct dates for different kinds of Time
Refactored & tightened specs for Schedule#occurs_on? edge cases.

Fixes #57 and #95.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment