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

LocalDatePattern.Parse throws IndexOutOfRangeException on some dates that match format but are not real dates #414

Closed
ghost opened this issue Dec 17, 2015 · 5 comments
Assignees

Comments

@ghost
Copy link

@ghost ghost commented Dec 17, 2015

Given a date string like "00/15/1984" and a local date pattern created with the format "M/d/yyyy", calling format.Parse(dateString) throws an index out of range exception, rather than simply returning a failed ParseResult.

We haven't tested other Noda pattern types for the same behavior, but wouldn't be surprised if it's there as well.

@jskeet jskeet self-assigned this Dec 17, 2015
@jskeet
Copy link
Member

@jskeet jskeet commented Dec 17, 2015

Hmmm... I'm getting an ArgumentOutOfRangeException with 2.0, but it's a bug anyway...
Thanks, will try to look at it very soon.

@ghost
Copy link
Author

@ghost ghost commented Dec 17, 2015

Good catch, we were on an older version of Noda (1.3.0.0).

Also good that it was still a bug. and didn't waste anyone's time!

@jskeet
Copy link
Member

@jskeet jskeet commented Dec 18, 2015

I suspect this one will be worth fixing on the 1.3.x branch as well, to be honest. I haven't looked into it yet, but I'm hoping it'll be very simple.

@jskeet
Copy link
Member

@jskeet jskeet commented Dec 18, 2015

Okay, found the bug. Single character typo :) Fixing in the 2.0 branch now, will then backport.

jskeet added a commit to jskeet/nodatime that referenced this issue Dec 18, 2015
Fixes issue nodatime#414 for 2.0. Still need a fix for 1.3.x.
jskeet added a commit that referenced this issue Dec 23, 2015
Fixes issue #414 for 1.3.x.
@jskeet
Copy link
Member

@jskeet jskeet commented Dec 23, 2015

Fixed in 1.3.x and 2.0 branches.

@jskeet jskeet closed this Dec 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant