Skip to content

Commit

Permalink
Merge pull request #196 from chiraganand/t188_dates_period
Browse files Browse the repository at this point in the history
use Dates.Period instead of the entire Union
  • Loading branch information
chiraganand authored Apr 25, 2024
2 parents 64a7e38 + 889538c commit e17f2c6
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 e17f2c6

Please sign in to comment.