Closed uzaif313 closed 7 years ago
Schedule.new
takes a start time, not a Rule object.
You can add rules to your schedule using add_recurrence_rule
You can add specific times to your schedule using add_recurrence_time
thanks for response @avit
rule = IceCube::Rule.weekly.day(1,2,3) // Weekly monday ,tuesday and Wednesday
specefic_dates = ["Sun, 01 Oct 2017", "Sun, 30 Oct 2017"] // now i need to add this dates in recurring
rule
schedule = IceCube::Schedule.new(Date.time)
schedule.add_recurrence_rule(rule)
schedule.add_recurrence_time(specefic_dates)
can i do it with above way?
Yes, but not with strings, they should be time objects.
Hi @avit I have added recurrence_time on schedule but when I try to check occurrence on a specific date. its throw an error, below are my steps please check
// t contain icecube schedule object
[14] pry(main)> t.add_recurrence_time(specefic_schedule)
=> [2017-10-01 07:26:08 +0530, 2017-10-08 07:26:08 +0530]
[15] pry(main)> t
=> #<IceCube::Schedule:0x00000006636a18
@all_exception_rules=[#<IceCube::SingleOccurrenceRule:0x000000065e44e8 @time=2017-09-25 00:00:00 +0530>],
@all_recurrence_rules=
[#<IceCube::WeeklyRule:0x00000006623f08
@interval=1,
@start_time=nil,
@time=nil,
@uses=0,
@validations=
{:interval=>[#<IceCube::Validations::WeeklyInterval::Validation:0x00000006623170 @interval=1, @week_start=:sunday>],
:base_hour=>[#<IceCube::Validations::ScheduleLock::Validation:0x000000066235a8 @type=:hour>],
:base_min=>[#<IceCube::Validations::ScheduleLock::Validation:0x00000006623508 @type=:min>],
:base_sec=>[#<IceCube::Validations::ScheduleLock::Validation:0x000000066233f0 @type=:sec>],
:day=>
[#<IceCube::Validations::Day::Validation:0x00000006622298 @day=1>,
#<IceCube::Validations::Day::Validation:0x00000006621cd0 @day=2>,
#<IceCube::Validations::Day::Validation:0x00000006620d58 @day=3>,
#<IceCube::Validations::Day::Validation:0x0000000661b6c8 @day=5>,
#<IceCube::Validations::Day::Validation:0x00000006619c60 @day=6>]},
@week_start=:sunday>,
#<IceCube::SingleOccurrenceRule:0x000000060880f8 @time=[2017-10-01 07:26:08 +0530, 2017-10-08 07:26:08 +0530]>],
@start_time=2017-09-26 00:00:00 +0530>
[16] pry(main)> t.occurs_on(Date.today+5.days)
NoMethodError: undefined method `occurs_on' for #<IceCube::Schedule:0x00000006636a18>
Did you mean? occurs_on?
occurs_at?
Start here:
NoMethodError: undefined method `occurs_on' for #<IceCube::Schedule:0x00000006636a18> Did you mean? occurs_on? occurs_at?
@uzaif313 the method is occurs_on?
not occurs_on
😄
@seejohnrun @avit
Ohh sorry, i forgot ?
but here is new one please check this one
t.occurs_on?(Time.now+4)
NoMethodError: undefined method `to_i' for [2017-10-02 00:21:26 +0530, 2017-10-09 00:21:26 +0530]:Array
Did you mean? to_s
to_a
to_h
from /home/uzaif/.rvm/gems/ruby-2.3.0/gems/ice_cube-0.16.2/lib/ice_cube/single_occurrence_rule.rb:18:in `next_time'
occurs_on?
should take in a Date
object ideally
Check the docs for add_recurrence_time to see what it expects.
(It looks like we don't have an example of this method in the README, and we should add it.)
ohh it take time
object but i think its not allow to add array of time object
SingleOccurrenceRule
I have created scheduling with recurring rule like below
will it possible to perform above stuff