Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IndexType to use AbstractDateTime rather than TimeType #22

Open
fsaad opened this issue Feb 26, 2025 · 0 comments
Open

Fix IndexType to use AbstractDateTime rather than TimeType #22

fsaad opened this issue Feb 26, 2025 · 0 comments

Comments

@fsaad
Copy link
Collaborator

fsaad commented Feb 26, 2025

The Dates module has a problem

julia > using Dates
julia> t = Time("14:20")
julia> DateTime(t)
ERROR: MethodError: Cannot `convert` an object of type Time to an object of type DateTime

Closest candidates are:
  convert(::Type{DateTime}, ::Date)
   @ Dates ~/julia-1.9.3/share/julia/stdlib/v1.9/Dates/src/conversions.jl:30
  convert(::Type{DateTime}, ::Millisecond)
   @ Dates ~/julia-1.9.3/share/julia/stdlib/v1.9/Dates/src/conversions.jl:34
  convert(::Type{T}, ::T) where T
   @ Base Base.jl:64
  ...

Stacktrace:
 [1] DateTime(dt::Time)
   @ Dates ~/julia-1.9.3/share/julia/stdlib/v1.9/Dates/src/conversions.jl:20

Even though any TimeType is allowed in DateTime:

julia> methods(DateTime)
...
[28] DateTime(dt::TimeType)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant