Skip to content

Commit

Permalink
Merge pull request #47 from femtotrader/fix_depwarns_julia_0.7
Browse files Browse the repository at this point in the history
Fix depwarns with Julia 0.7
  • Loading branch information
femtotrader authored Jul 19, 2018
2 parents 4b6cfa8 + 5213808 commit 2615e1a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/TimeFrames.jl
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ function range(dt1::Dates.TimeType, tf::AbstractPeriodFrame, dt2::Dates.TimeType
end

function range(dt1::Dates.TimeType, tf::AbstractPeriodFrame, len::Integer)
range(dt1, tf.period, len)
range(dt1, step=tf.period, length=len)
end

function range(tf::AbstractPeriodFrame, dt2::Dates.TimeType, len::Integer)
range(dt2 - len * tf.period, tf.period, len)
range(dt2 - len * tf.period, step=tf.period, length=len)
end

range(dt1::DateTime, tf::NoTimeFrame, dt2::DateTime) = [dt1]
Expand All @@ -289,12 +289,12 @@ promote_timetype(::Type{Date}, ::Type{Second}) = DateTime
promote_timetype(::Type{Date}, ::Type{Millisecond}) = DateTime

promote_timetype(::Type{Dates.Time}, ::Type) = Dates.Time
promote_timetype(::Type{Dates.Time}, ::Type{YearBegin}) = throw(InexactError())
promote_timetype(::Type{Dates.Time}, ::Type{YearEnd}) = throw(InexactError())
promote_timetype(::Type{Dates.Time}, ::Type{MonthBegin}) = throw(InexactError())
promote_timetype(::Type{Dates.Time}, ::Type{MonthEnd}) = throw(InexactError())
promote_timetype(::Type{Dates.Time}, ::Type{Week}) = throw(InexactError())
promote_timetype(::Type{Dates.Time}, ::Type{Day}) = throw(InexactError())
promote_timetype(::Type{Dates.Time}, ::Type{YearBegin}) = throw(InexactError(:none, Any, nothing))
promote_timetype(::Type{Dates.Time}, ::Type{YearEnd}) = throw(InexactError(:none, Any, nothing))
promote_timetype(::Type{Dates.Time}, ::Type{MonthBegin}) = throw(InexactError(:none, Any, nothing))
promote_timetype(::Type{Dates.Time}, ::Type{MonthEnd}) = throw(InexactError(:none, Any, nothing))
promote_timetype(::Type{Dates.Time}, ::Type{Week}) = throw(InexactError(:none, Any, nothing))
promote_timetype(::Type{Dates.Time}, ::Type{Day}) = throw(InexactError(:none, Any, nothing))

+(t::T, tf::TF) where {T<:Dates.TimeType, TF<:TimeFrame} =
convert(promote_timetype(T, TF), t) + tf.period
Expand Down

0 comments on commit 2615e1a

Please sign in to comment.