Skip to content

Commit

Permalink
use Dates.Period instead of the entire Union
Browse files Browse the repository at this point in the history
  • Loading branch information
chiraganand committed Apr 25, 2024
1 parent 64a7e38 commit 889538c
Showing 1 changed file with 2 additions and 28 deletions.
30 changes: 2 additions & 28 deletions src/endpoints.jl
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
"""
# Computing end points
```julia
endpoints(timestamps::AbstractVector{T}, on::V) where {T<:Union{Date, DateTime, Time},
V<:Union{
Year,
Quarter,
Month,
Week,
Day,
Hour,
Minute,
Second,
Millisecond,
Microsecond,
Nanosecond
}}
endpoints(timestamps::AbstractVector{T}, on::V) where {T<:Union{Date, DateTime, Time}, V<:Dates.Period}
endpoints(ts::TSFrame, on::T) where {T<:Dates.Period}
endpoints(ts::TSFrame, on::Symbol, k::Int=1)
endpoints(ts::TSFrame, on::String, k::Int=1)
Expand Down Expand Up @@ -317,20 +304,7 @@ function endpoints(ts::TSFrame, on::Function, k::Int=1)
endpoints(index(ts), on, k)
end

function endpoints(timestamps::AbstractVector{T}, on::V)::Vector{Int} where {T<:Union{Date, DateTime, Time},
V<:Union{
Year,
Quarter,
Month,
Week,
Day,
Hour,
Minute,
Second,
Millisecond,
Microsecond,
Nanosecond
}}
function endpoints(timestamps::AbstractVector{T}, on::V)::Vector{Int} where {T<:Union{Date, DateTime, Time}, V<:Dates.Period}
if (on.value <= 0)
throw(DomainError("`on.value` needs to be greater than 0"))
end
Expand Down

0 comments on commit 889538c

Please sign in to comment.