Skip to content

Commit

Permalink
Use interval min/max functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvind Maan committed Dec 30, 2020
1 parent f263f49 commit cb57398
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[compat]
Intervals = "1.3"
Intervals = "1.5"
julia = "1.3"

[extras]
Expand Down
11 changes: 2 additions & 9 deletions src/common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,11 @@ Helper function to turn an AbstractInterval into a StepRange taking the inclusiv
account.
"""
function _interval2daterange(dates::AbstractInterval{Date})
fd = _firstdate(dates)
ld =_lastdate(dates)
fd = minimum(dates)
ld = maximum(dates)
return fd:Day(1):ld
end

# TODO: remove this once https://github.com/invenia/Intervals.jl/issues/137
# is addressed.
_firstdate(dates::AbstractInterval{Date,Closed}) = first(dates)
_firstdate(dates::AbstractInterval{Date,Open}) = first(dates) + Day(1)
_lastdate(dates::AbstractInterval{Date,<:Bound,Closed}) = last(dates)
_lastdate(dates::AbstractInterval{Date,<:Bound,Open}) = last(dates) - Day(1)

"""
_initial_date(s::S, dates) where S<: DateSelector
Expand Down

0 comments on commit cb57398

Please sign in to comment.