Learn R Programming

almanac (version 0.1.1)

recur_on_easter: Recur on easter

Description

recur_on_easter() is a special helper to recur on Easter. Easter is particularly difficult to construct a recurrence rule for. Using offset, this can also be used to generate a recurrence rule on Easter Monday or Good Friday.

Usage

recur_on_easter(x, offset = 0L)

Value

An updated rrule.

Arguments

x

[rrule]

A recurrence rule.

offset

[integer(1)]

An offset in terms of a number of days on either side of Easter to recur on. This offset must still fall within the same year, otherwise the date will be silently ignored.

Examples

Run this code
on_easter <- yearly() %>% recur_on_easter()
on_easter_monday <- yearly() %>% recur_on_easter(-1)

alma_search("1999-01-01", "2001-01-01", on_easter)

rb <- runion() %>%
  add_rschedule(on_easter) %>%
  add_rschedule(on_easter_monday)

alma_search("1999-01-01", "2001-01-01", rb)


# Note that `offset` must land within the same year, otherwise the date
# is ignored
on_easter_back_93_days <- yearly() %>% recur_on_easter(-93)
on_easter_back_94_days <- yearly() %>% recur_on_easter(-94)

alma_search("1999-01-01", "2001-01-01", on_easter_back_93_days)
alma_search("1999-01-01", "2001-01-01", on_easter_back_94_days)

Run the code above in your browser using DataLab