You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Dates
(Dates.Hour(1):Dates.Hour(1):Dates.Hour(2))[1:0]
Errors with
ERROR: MethodError: no method matching copysign(::Hour, ::Hour)
The function `copysign` exists, but no method is defined for this combination of argument types.
Closest candidates are:
copysign(::Float64, ::Float64)
@ Base floatfuncs.jl:5
copysign(::Float64, ::Real)
@ Base floatfuncs.jl:8
copysign(::Float32, ::Float32)
@ Base floatfuncs.jl:6
...
Stacktrace:
[1] getindex(r::StepRange{Hour, Hour}, s::UnitRange{Int64})
@ Base .\range.jl:1029
[2] top-level scope
A possible fix would be to define Base.copysign on TimePeriod. The below works
import Dates.value
Base.copysign(x::T, y::T) where T<:TimePeriod=T(copysign(value(x), value(y)))
(Dates.Hour(1):Dates.Hour(1):Dates.Hour(2))[1:0]
The text was updated successfully, but these errors were encountered:
nsajko
added
dates
Dates, times, and the Dates stdlib module
bug
Indicates an unexpected problem or unintended behavior
labels
Jan 15, 2025
For example:
Errors with
A possible fix would be to define
Base.copysign
onTimePeriod
. The below worksThe text was updated successfully, but these errors were encountered: