Description Usage Arguments Examples
on_event()
defines an alternative date to use as an event if event
occurs. It is usually useful as a way to deviate from a normal schedule in
the case of an unusual circumstance.
1 | on_event(x, event, jump)
|
x |
An event defining normal behavior. |
event |
An event defining when a |
jump |
A jump defining the deviation from normal behavior. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Imagine the garbage truck normally comes every Monday, but if
# Monday is a state holiday, then it comes on Tuesday instead. In this case
# we can use `event = on_state_holiday` as a trigger to define an alternative
# event rule.
on_normal_trash_day <- on_wday("Monday")
on_state_holiday <- on_month("Sep") & on_mweek(1) & on_wday("Monday")
on_trash_day <- on_event(on_normal_trash_day, on_state_holiday, days(1))
# A Monday in September
event_in("2019-09-09", on_normal_trash_day)
event_in("2019-09-09", on_trash_day)
# Labor Day Monday should not be trash day
event_in("2019-09-02", on_normal_trash_day)
event_in("2019-09-02", on_trash_day)
# The day after Labor Day Monday is trash day
event_in("2019-09-03", on_normal_trash_day)
event_in("2019-09-03", on_trash_day)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.