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

Comments

Projects
None yet
1 participant
@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

This comment has been minimized.

Show comment
Hide comment
@jskeet

jskeet Dec 17, 2015

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost 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!

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

This comment has been minimized.

Show comment
Hide comment
@jskeet

jskeet Dec 18, 2015

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@jskeet

jskeet Dec 18, 2015

Member

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

Member

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

Disallow a month number of 0 when parsing
Fixes issue #414 for 2.0. Still need a fix for 1.3.x.

jskeet added a commit that referenced this issue Dec 23, 2015

@jskeet

This comment has been minimized.

Show comment
Hide comment
@jskeet

jskeet Dec 23, 2015

Member

Fixed in 1.3.x and 2.0 branches.

Member

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