I’m trying to port some code from v0.6 to v1.0 and I don’t know how to get it right.
I have d
:
d = ["$(rand(2000:2020))-$(rand(1:12))-$(rand(1:28))" for _ in 1:100]
And then in v0.7
julia> Date(d, "yyyy-mm-dd", locale = Dates.LOCALES["english"])
┌ Warning: `Date(Y::AbstractArray{<:AbstractString}, f::AbstractString; locale::Locale=ENGLISH)` is deprecated, use `Date.(Y, f; locale=locale)` instead.
│ caller = top-level scope at none:0
└ @ Core none:0
100-element Array{Date,1}:
2004-10-24
2002-10-20
2000-11-11
...
julia> Date.(d, "yyyy-mm-dd", locale = Dates.LOCALES["english"])
100-element Array{Date,1}:
2004-10-24
2002-10-20
2000-11-11
...
But in v1:
julia> Date.(d, "yyyy-mm-dd", locale = Dates.LOCALES["english"])
ERROR: MethodError: no method matching Date(::Date, ::String; locale=Dates.DateLocale(["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], Dict("January"=>1,"august"=>8,"May"=>5,"may"=>5,"December"=>12,"january"=>1,"August"=>8,"november"=>11,"december"=>12,"September"=>9…), Dict("Aug"=>8,"May"=>5,"may"=>5,"Jul"=>7,"Dec"=>12,"Apr"=>4,"nov"=>11,"jul"=>7,"Oct"=>10,"apr"=>4…), Dict("Thursday"=>4,"friday"=>5,"sunday"=>7,"Wednesday"=>3,"thursday"=>4,"saturday"=>6,"Monday"=>1,"Tuesday"=>2,"tuesday"=>2,"wednesday"=>3…), Dict("Tue"=>2,"wed"=>3,"mon"=>1,"Wed"=>3,"Sun"=>7,"fri"=>5,"Thu"=>4,"sat"=>6,"Mon"=>1,"sun"=>7…)))
Closest candidates are:
Date(::Any, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Dates/src/types.jl:315 got unsupported keyword argument "locale"
Date(::Any, ::Any, ::Any) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Dates/src/types.jl:315 got unsupported keyword argument "locale"
Date(::TimeType) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Dates/src/conversions.jl:12 got unsupported keyword argument "locale"
...
Stacktrace:
[1] (::getfield(Base.Broadcast, Symbol("##24#25")){Base.Iterators.Pairs{Symbol,Dates.DateLocale,Tuple{Symbol},NamedTuple{(:locale,),Tuple{Dates.DateLocale}}},DataType})(::Date, ::Vararg{Any,N} where N) at ./broadcast.jl:1148
[2] _broadcast_getindex_evalf at ./broadcast.jl:574 [inlined]
[3] _broadcast_getindex at ./broadcast.jl:547 [inlined]
[4] getindex at ./broadcast.jl:507 [inlined]
[5] copy at ./broadcast.jl:758 [inlined]
[6] materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,getfield(Base.Broadcast, Symbol("##24#25")){Base.Iterators.Pairs{Symbol,Dates.DateLocale,Tuple{Symbol},NamedTuple{(:locale,),Tuple{Dates.DateLocale}}},DataType},Tuple{Base.RefValue{Date},Base.RefValue{String}}}) at ./broadcast.jl:748
[7] top-level scope at none:0