Opening hours in ice_cube
Asked Answered
D

1

3

How am I able to rule opening hours of a restaurant within single Schedule?

Mon-Fri 8-16 is quite easy:

schedule = Schedule.new(Time.parse(Date.yesterday.to_s + ' 8:00'), :duration => 60*60*8)
(...)
schedule.add_recurrence_rule Rule.daily.day(:wednesday)
schedule.add_recurrence_rule Rule.daily.day(:thursday)
(...)
schedule.occurring_at?(Time.now)

Problem is when trying to rule something like: Mon 9-17, Tu 16-01 (the next day after midnight) etc.

Am I able to do this with that plugin?

Dorsy answered 21/11, 2012 at 15:46 Comment(0)
D
3

Just got email from an Ice_Cube author answering my question. Might be usefull:

Unfortunately we strive to maintain backwards compatibility with the iCalendar standard - so you can't change durations on a per-rule basis. If you want to accomplish something like the above, people either use multiple schedules, or store the durations separately (the latter is highly preferred)

Dorsy answered 24/11, 2012 at 8:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.