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

Dates.parse(::AbstractString, ::DateFormat) removed without deprecation #20876

Closed
omus opened this issue Mar 3, 2017 · 3 comments
Closed

Dates.parse(::AbstractString, ::DateFormat) removed without deprecation #20876

omus opened this issue Mar 3, 2017 · 3 comments
Labels
domain:dates Dates, times, and the Dates stdlib module

Comments

@omus
Copy link
Member

omus commented Mar 3, 2017

Julia 0.5 had a Dates.parse function which could parse a string into an Array{Period}. The function was useful for parsing DateTimes which needed modification before constructing a DateTime object.

For example on Julia 0.5:

julia> df = Dates.DateFormat("yyyy-mm-dd HH:MM");

julia> DateTime("2016-03-03 24:00", df)
ERROR: ArgumentError: Hour: 24 out of range (0:23)
 in DateTime(::Int64, ::Int64, ::Int64, ::Int64, ::Int64, ::Int64, ::Int64) at ./dates/types.jl:149
 in DateTime(::Base.Dates.Year, ::Base.Dates.Month, ::Base.Dates.Day, ::Base.Dates.Hour, ::Base.Dates.Minute) at ./dates/types.jl:172
 in DateTime(::String, ::Base.Dates.DateFormat) at ./dates/io.jl:268

julia> Dates.parse("2016-03-03 24:00", df)
5-element Array{Base.Dates.Period,1}:
 2016 years
 3 months  
 3 days    
 24 hours  
 0 minutes 

In Julia 0.6

julia> Dates.parse("2016-03-03 24:00", Dates.DateFormat("yyyy-mm-dd HH:MM"))
ERROR: MethodError: no method matching parse(::String, ::DateFormat{Symbol("yyyy-mm-dd HH:MM"),Tuple{Base.Dates.DatePart{'y'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'m'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'d'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'H'},Base.Dates.Delim{Char,1},Base.Dates.DatePart{'M'}}})
Closest candidates are:
  parse(::AbstractString, ::Int64; greedy, raise) at parse.jl:215
  parse(::AbstractString; raise) at parse.jl:230
@omus omus added the domain:dates Dates, times, and the Dates stdlib module label Mar 3, 2017
@omus
Copy link
Member Author

omus commented Mar 3, 2017

Removed by #19545

@StefanKarpinski
Copy link
Sponsor Member

@shashi, can we add that feature back within the new fast parsing framework? Otherwise it should technically be deprecated, but it seems like making it work would be even better as it's useful.

@omus
Copy link
Member Author

omus commented Mar 3, 2017

@StefanKarpinski I'm attempting to get a version of this working with 0.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:dates Dates, times, and the Dates stdlib module
Projects
None yet
Development

No branches or pull requests

2 participants