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 #52989: DateTime parser would return an error when parsing a year string #53954

Merged
merged 1 commit into from
Apr 6, 2024

Conversation

Viriato5
Copy link
Contributor

@Viriato5 Viriato5 commented Apr 4, 2024

Fix #52989.
Originally checked on version 1.10.0 but still relevant in the current version in master

Bug: When executing the method DateTime to create a DateTime value with a string input only containing a year (ex: "2000") the method returns an 'ArgumentError: Invalid DateTime string' when it should, from what I understood, return a DateTime like 2000-01-01T00:00:00 seeing as if you call the same method with a number indicating a year (ex: 2000) the method returns correctly.

Fix: The fix was simple, on the first tryparsenext_base10 block (line 207-211) where a year is parsed from the string the exit condition i > end_pos should jump into 'done' so it returns a correct value instead of 'error'

@quinnj quinnj merged commit 821c608 into JuliaLang:master Apr 6, 2024
8 checks passed
@quinnj
Copy link
Member

quinnj commented Apr 6, 2024

Thanks @Viriato5!

@giordano giordano added the dates Dates, times, and the Dates stdlib module label Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dates Dates, times, and the Dates stdlib module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot parse a year string with DateTime
3 participants