% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{.prev_on_cycle}
\alias{.prev_on_cycle}
\title{Find the most recent cycle point before a given time}
\usage{
.prev_on_cycle(
  start,
  current = Sys.time(),
  amount = 1L,
  unit = c("second", "minute", "hour", "day", "week", "month", "year")
)
}
\arguments{
\item{start}{\code{Date} or \code{POSIXct} defining the cycle origin.}

\item{current}{\code{Date} or \code{POSIXct} (coerced to match \code{start})
used as the reference point. Defaults to \code{Sys.time()}.}

\item{amount}{Positive integer; number of \code{unit}s per cycle step.}

\item{unit}{Character; one of \code{"second"}, \code{"minute"},
\code{"hour"}, \code{"day"}, \code{"week"}, \code{"month"},
\code{"year"}. Sub-day units are not supported when \code{start} is a
\code{Date}.}
}
\value{
A \code{Date} or \code{POSIXct} of the same class and timezone as
\code{start}, or \code{NA} if \code{current <= start}.
}
\description{
Given a repeating cycle anchored at \code{start} and stepping every
\code{amount} \code{unit}s, returns the latest cycle point strictly before
\code{current}.
}
\keyword{internal}
