R/feb29-to-28.R

Defines functions dtt_feb29_to_28

Documented in dtt_feb29_to_28

#' Feb 29 to Feb 28
#'
#' @param x A Date or POSIXct vector.
#'
#' @return The modified Date or POSIXct vector.
#' @export
#'
#' @examples
#' dtt_feb29_to_28(as.Date("2004-02-29"))
dtt_feb29_to_28 <- function(x) {
  check_dtt(x)
  wch <- which(dtt_month(x) == 2L & dtt_day(x) == 29L)
  dtt_day(x[wch]) <- 28L
  x
}
poissonconsulting/dttr documentation built on Feb. 20, 2021, 12:18 a.m.