savonrb / nori

XML to Hash translator
MIT License
247 stars 74 forks source link

Make Date, Time & DateTime regexps more accurate #62

Closed lackac closed 9 years ago

lackac commented 10 years ago

Particularly, support Z timezone representation with fractional seconds. New examples are also provided for newly supported formats.

tjarratt commented 10 years ago

Thanks for the pull request @lackac! Seems like this change would benefit from a spec or two in the unit tests for nori so I took the time to write some failing tests.

Unfortunately it looks like parsing a datetime string with fractional seconds isn't working. I debugged it briefly and it looks like matching a datetime string with fractional seconds OR a Z at the end wasn't being matched by the regex. You can check out the failing tests on this branch.

lackac commented 10 years ago

The problem was with the test. You left -05:00 there in the string before inserting .5Z. There cannot be two timezone representations in a datetime string.

I amended the two tests and added it to the PR.

tjarratt commented 10 years ago

Well that was a silly mistake to make -- thanks for catching it!