-
Notifications
You must be signed in to change notification settings - Fork 102
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
Microseconds: fix and testcase for a bug #77
base: master
Are you sure you want to change the base?
Conversation
@qrilka note the CI build failed |
Formatting was fixed and parsing is buggy - I've added a testcase and proper fix needs parsing to be almost rewritten |
@qrilka any updates on the build failure? |
this build failure was intended - it shows that the parsing code is broken. |
@qrilka ok. I understand now. Thanks. I will see if I can find some time to fix it. |
Damn, @ericbmerritt you know what is going on here and what needs fixing? |
No clue. I need to dig into this. Fortunately, with a good test case its doable. Thanks @qrilka |
@tsloughter the reported problem is that parsing works only for strings with 6(or zero) digits after the comma, the test case supplied shows it failing parsing |
Up! Example: > ec_date:tokenise("2016-08-18T09:37:29.000456Z", []).
[2016,45,8,45,18,9,58,37,58,29,46,456,90]
> ec_date:parse("2016-08-18T09:37:29.456+0000").
{{2016,8,18},{9,37,29,456}}
> ec_date:parse("2016-08-18T09:37:29.1+0000").
{{2016,8,18},{9,37,29,1}}
> ec_date:parse("2016-08-18T09:37:29.000456Z").
** exception throw: {ec_date,{bad_date,"2016-08-18T09:37:29.000456Z"}}
in function ec_date:do_parse/3 (/private/tmp/erlware_commons/_build/default/lib/erlware_commons/src/ec_date.erl, line 106) |
Still needs the tests to pass. |
It looks like @erszcz's commit covers this exact case |
#109 which is now merged was based on this |
Added proper zero padding for microseconds in date formatting and a testcase for the bug in parsing those microseconds