Some periods of time, e.g. Millisecond vs Month, behave as incomparable:
using Dates
Millisecond(2) < Week(2) # true
Millisecond(2) < Month(2) # error
The reason for this error is unclear for me. Even the error trace (see below) says that there exists a corresponding isless
method:
julia> Millisecond(2) < Month(2)
ERROR: MethodError: no method matching isless(::Millisecond, ::Month)
Closest candidates are:
isless(::Union{Day, Hour, Microsecond, Millisecond, Minute, Nanosecond, Second, Week}, ::Union{Month, Year}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Dates/src/periods.jl:464
isless(::Period, ::Period) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Dates/src/periods.jl:71
isless(::Missing, ::Any) at missing.jl:66
...
Stacktrace:
[1] isless(::Millisecond, ::Month) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Dates/src/periods.jl:464
[2] <(::Millisecond, ::Month) at ./operators.jl:260
[3] top-level scope at none:0
versioninfo()
:
Julia Version 1.0.2
Commit d789231e99 (2018-11-08 20:11 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Xeon(R) CPU E5-1650 v4 @ 3.60GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, broadwell)
Environment:
JULIA_VERSION = 1.0.2
JULIA_NUM_THREADS = 12