The period_boundaries is a deprecated function. It will shift the input date vector by a number of months and years i.e. date + offset_period * offset_type. It will handle the typical business date arithmetic.

period_boundaries(date = Sys.Date(), offset_period = 0,
  offset_type = "year", bus_period = "FY", boundary = "1st day",
  optFYstart = getOption("busdaterFYstart", default = "07-01"))

Arguments

date

A date vector for which financial year is required. Date must be POSIXct or POSIXlt or Date objects.

offset_period

A positive or negative number coercible to integer to shift the year by, e.g. in the case of FY, -1 for previous year, 1 for next year. More generally in page_boundaries function it is a number of periods of a specified period type

offset_type

It is either "month" or "year"

bus_period

It is either "FY" for financial year, "CE" for calendar year or "M" for month

boundary

Either "1st day" for the first day of the period or "last day" for the end of the period.

optFYstart

A string in the format of "MM-DD" representing the start of financial year, e.g. "01-01" for 1st of January or "07-01" for 1st of July. This package caters for financial years that have a fixed start date. It does not cater for moving dates e.g. last Friday of September.

Value

A vector of dates.

See also

Other business date functions: FY, get_boundary, get_fy

Examples

# the 1st day of the current financial year period_boundaries()
#> Warning: period_boundaries deprecated, replaced by get_boundary
#> [1] "2018-07-01"
# the last day of the current financial year period_boundaries(boundary = "last day")
#> Warning: period_boundaries deprecated, replaced by get_boundary
#> [1] "2019-06-30"
# the last day of the last calendar year period_boundaries(offset_period = -1, bus_period = "CY", boundary = "last day")
#> Warning: period_boundaries deprecated, replaced by get_boundary
#> [1] "2018-12-31"
# the last day of month 14 months from now period_boundaries(offset_period = 14, offset_type = "month", bus_period = "M", boundary = "last day")
#> Warning: period_boundaries deprecated, replaced by get_boundary
#> [1] "2020-03-31"
# The first day of financial years for dates 3 months before the given dates period_boundaries(as.Date(c("02/27/1992", "09/28/2022"), "%m/%d/%Y"), offset_period = -3, offset_type = "month", bus_period = "FY", boundary = "1st day")
#> Warning: period_boundaries deprecated, replaced by get_boundary
#> [1] "1991-07-01" "2021-07-01"