Skip to contents

Adds delays to reference dates using unit-aware date arithmetic.

Usage

get_report_dates(reference_dates, delays, delays_unit)

Arguments

reference_dates

Date vector of reference dates.

delays

Numeric vector of delays.

delays_unit

Character string specifying the temporal granularity of the delays. Options are "days", "weeks", "months", "years". Default is "days".

Value

Date vector of report dates.

Examples

# Compute report dates with days
ref_date <- as.Date("2024-01-01")
get_report_dates(ref_date, 7, "days") # 2024-01-08
#> [1] "2024-01-08"

# Compute report dates with weeks
get_report_dates(ref_date, 2, "weeks") # 2024-01-15
#> [1] "2024-01-15"