recur_on_easter {almanac}R Documentation

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)

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.

Value

An updated rrule.

Examples

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)

[Package almanac version 0.1.1 Index]