diff --git a/stdlib/Dates/src/adjusters.jl b/stdlib/Dates/src/adjusters.jl index 4687b22badad5..d5617ba8cf93c 100644 --- a/stdlib/Dates/src/adjusters.jl +++ b/stdlib/Dates/src/adjusters.jl @@ -2,10 +2,12 @@ ### truncation Base.trunc(dt::Date, p::Type{Year}) = Date(UTD(totaldays(year(dt), 1, 1))) +Base.trunc(dt::Date, p::Type{Quarter}) = firstdayofquarter(dt) Base.trunc(dt::Date, p::Type{Month}) = firstdayofmonth(dt) Base.trunc(dt::Date, p::Type{Day}) = dt Base.trunc(dt::DateTime, p::Type{Year}) = DateTime(trunc(Date(dt), Year)) +Base.trunc(dt::DateTime, p::Type{Quarter}) = DateTime(trunc(Date(dt), Quarter)) Base.trunc(dt::DateTime, p::Type{Month}) = DateTime(trunc(Date(dt), Month)) Base.trunc(dt::DateTime, p::Type{Day}) = DateTime(Date(dt)) Base.trunc(dt::DateTime, p::Type{Hour}) = dt - Minute(dt) - Second(dt) - Millisecond(dt)