【发布时间】:2019-12-06 18:47:55
【问题描述】:
我正在使用 Ice Cube gem https://github.com/seejohnrun/ice_cube 安排活动,我想让每个活动在每周一出现在应用程序中,并且在 6 小时后,活动标题应标记为红色。
doc ice cube 中有这个设置持续时间的例子
# or give the schedule a duration and ask if occurring_at?
schedule = IceCube::Schedule.new(now, :duration => 3600)
schedule.add_recurrence_rule IceCube::Rule.daily
schedule.occurring_at?(now + 1800) # true
我将其翻译成我的需要如下:
start_date = Time.now.utc - 10.days # any datetime basically
schedule = IceCube::Schedule.new(start_date, :duration => (6.hours).seconds)
schedule.add_recurrence_rule IceCube::Rule.weekly(1).day(:monday)
但据我所知,6 小时的持续时间似乎只适用于第一次发生(从 start_date 开始的 6 小时),我想要的是从每周一开始的 6 小时。
【问题讨论】: