R/dated_warning_or_error.R

Defines functions dated_warning_or_error

Documented in dated_warning_or_error

#' Give a warning or error based on the current date
#'
#' @param date The date cutoff
#' @param ... Passed to \code{stop} if todays date is < \code{date} or
#'   \code{warning} otherwise.
#' @export
dated_warning_or_error <- function(date, ...) {
  if (as.character(Sys.Date()) > as.character(date)) {
    stop(...)
  } else {
    warning(...)
  }
}
billdenney/bsd.report documentation built on Jan. 16, 2024, 12:54 a.m.