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
{{ message }}
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.
Should issues go here or directly to JuliaLang/julia now that this is in base? In any case, if you don't specify a format and your format doesn't match the default format, it's possible to get an incorrect result instead of an error.
julia> DateTime("2014")
ERROR: ArgumentError("Delimiter mismatch. Couldn't find first delimiter, \"-\", in date string")
in parse at dates/io.jl:116
in DateTime at dates/io.jl:162
julia> DateTime("2014-09")
2014-09-01T00:00:00
julia> DateTime("2014-09-06")
2014-09-06T00:00:00
julia> DateTime("2014-09-06 02:45:38")
2014-09-01T00:00:00
Of course this works fine if the correct format string is specified.
Yeah, that is tricky. The whole providing-a-default format string has pretty much only led to problems, at least for DateTime. Maybe we get rid of it for DateTime and make the user supply the format string. Dates are much less prone to error, so maybe we can keep it there.
Yeah, I'd definitely prefer no default format over "random" silent failures. I haven't done ruby for at least 6 years, but my recollection was that their DateTime would often just magically get the right answer. That's probably pretty complicated and still somewhat error prone, though.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Should issues go here or directly to JuliaLang/julia now that this is in base? In any case, if you don't specify a format and your format doesn't match the default format, it's possible to get an incorrect result instead of an error.
Of course this works fine if the correct format string is specified.
The text was updated successfully, but these errors were encountered: