Skip to content

Commit f831d99

Browse files
added missing trunc methods for Quarter
1 parent 9572202 commit f831d99

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

stdlib/Dates/src/adjusters.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
### truncation
44
Base.trunc(dt::Date, p::Type{Year}) = Date(UTD(totaldays(year(dt), 1, 1)))
5+
Base.trunc(dt::Date, p::Type{Quarter}) = firstdayofquarter(dt)
56
Base.trunc(dt::Date, p::Type{Month}) = firstdayofmonth(dt)
67
Base.trunc(dt::Date, p::Type{Day}) = dt
78

89
Base.trunc(dt::DateTime, p::Type{Year}) = DateTime(trunc(Date(dt), Year))
10+
Base.trunc(dt::DateTime, p::Type{Quarter}) = DateTime(trunc(Date(dt), Quarter))
911
Base.trunc(dt::DateTime, p::Type{Month}) = DateTime(trunc(Date(dt), Month))
1012
Base.trunc(dt::DateTime, p::Type{Day}) = DateTime(Date(dt))
1113
Base.trunc(dt::DateTime, p::Type{Hour}) = dt - Minute(dt) - Second(dt) - Millisecond(dt)

0 commit comments

Comments
 (0)