ice_cube 的营业时间 [英] Opening hours in ice_cube

查看:59
本文介绍了ice_cube 的营业时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何能够在单个时间表内控制餐厅的营业时间?

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

周一至周五 8-16 日很容易:

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)

问题是在尝试进行以下规则时:周一 9-17,Tu 16-01(午夜后的第二天)等

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?

推荐答案

刚刚收到 Ice_Cube 作者回复我的问题的电子邮件.可能有用:

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

遗憾的是,我们努力保持与 iCalendar 标准的向后兼容性 - 因此您无法根据规则更改持续时间.如果你想完成类似上面的事情,人们要么使用多个时间表,要么单独存储持续时间(后者是非常受欢迎的)

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)

这篇关于ice_cube 的营业时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆