forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dates: Error on construction/parsing with empty strings (JuliaLang#47117
) When attempting to construct a `DateTime`, `Date` or `Time` from an `AbstractString`, throw an `ArgumentError` if the string is empty. Likewise, error when `parse`ing an empty string as one of these types, and return `nothing` from `tryparse`. This behavior differs from previously. Before, `Date` and `Time` would return default values of `Date(1)` and `Time(0)`, respectively, while `DateTime` would error without a `format` argument. With a `format` argument, it would return `DateTime(1)`. However, this appears not to have been explicitly intended, but rather a consequence of the way parsing was implemented; no tests for empty string parsing existed. This addresses JuliaLang#28090 and JuliaLang#43883; see discussion therein. Summary of changes: - Check for empty string in `Base.parse(::DateTime)` and throw if so. - Change documentation to mention this. - Add a compat notice to the docs contrasting the old behavior.
- Loading branch information
Showing
4 changed files
with
44 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters