Skip to contents

Test to check if a date, or intervals is within a given financial year. If given just one date it will check to see if it is in the given financial year. When supplied with two dates it will check to see if any part of that date range falls in the given financial year. If the date_end is NA it checks that date was before or during the financial year.

Usage

is_date_in_fyyear(fyyear, date, date_end = NULL)

Arguments

fyyear

The financial year in the format '1718' as a character

date

The main/start date to check

date_end

(optional) The end date

Value

a logical, TRUE/FALSE

Examples

is_date_in_fyyear("2223", Sys.time())
#> [1] FALSE
is_date_in_fyyear(
  fyyear = "2122",
  date = as.Date("2020-01-01"),
  date_end = as.Date("2023-01-01")
)
#> [1] TRUE