Closed
Description
openedon Feb 24, 2021
julia> using Dates
julia> dt = DateTime(2018, 1, 1)
2018-01-01T00:00:00
julia> dt = DateTime(2018, 1, 1);
julia> a = dt:Hour(1):dt + Hour(5);
julia> b = dt + Hour(2):Hour(1):dt + Hour(7);
julia> intersect(a,b)
ERROR: MethodError: no method matching rem(::Millisecond, ::Hour)
Closest candidates are:
rem(::Any, ::Any, ::RoundingMode{:ToZero}) at div.jl:67
rem(::Any, ::Any, ::RoundingMode{:Down}) at div.jl:68
rem(::Any, ::Any, ::RoundingMode{:Up}) at div.jl:69
...
Stacktrace:
[1] intersect(::StepRange{DateTime,Hour}, ::StepRange{DateTime,Hour}) at ./range.jl:852
[2] top-level scope at REPL[7]:1
julia> intersect(collect(a), b) # Works, but returns a vector rather than a StepRange
4-element Array{DateTime,1}:
2018-01-01T02:00:00
2018-01-01T03:00:00
2018-01-01T04:00:00
2018-01-01T05:00:00
julia> @which intersect(a, b)
intersect(r::StepRange, s::StepRange) in Base at range.jl:822
julia> @which intersect(collect(a), b)
intersect(itr, itrs...) in Base at array.jl:2566
julia> versioninfo()
Julia Version 1.5.2
Commit 539f3ce943 (2020-09-23 23:17 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin18.7.0)
CPU: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
JULIA_MPI_PATH = /usr/local/Cellar/open-mpi/4.0.3/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment