Skip to contents

Find the next date that an automated report is supposed to be run. Likely, this function will only be relevant for shiny apps when this date is to be printed

Usage

findNextRunDate(
  runDayOfYear,
  baseDayNum = as.POSIXlt(Sys.Date())$yday + 1,
  startDate = NULL,
  returnFormat = "%A %e. %B %Y"
)

Arguments

runDayOfYear

Numeric vector providing year-day numbers

baseDayNum

Numeric defining base year-day. Default is today

startDate

Character string of format "YYYY-MM-DD" defining the date of the very first run. If set to NULL (default) or a none future date (compared to the date represented by baseDayNum for the current year) it will be disregarded.

returnFormat

String providing return format as described in strptime in the current locale. Defaults to "%A %d. %B %Y" that will provide something like 'Mandag 20. januar 2019' in a Norwegian locale

Value

String date for printing

Examples

# Will return Jan 30 in the current year and locale with default formatting
findNextRunDate(c(10, 20, 30), 20)
#> [1] "Thursday 30. January 2025"