-
Notifications
You must be signed in to change notification settings - Fork 5k
issue-46477 Fix issue about checking last char in datetime string. #46614
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
issue-46477 Fix issue about checking last char in datetime string. #46614
Conversation
|
||
Assert.Throws<FormatException>(() => DateTime.Parse("2020-5-7T09:37:00.0000000-07:00c")); | ||
Assert.Throws<FormatException>(() => DateTime.Parse("2020-5-7T09:37:00.0000000-07:00c", new MyFormatter())); | ||
Assert.Throws<FormatException>(() => DateTime.Parse("2020-5-7T09:37:00.0000000-07:00c", new MyFormatter(), DateTimeStyles.NoCurrentDateDefault)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should continue to work (per the strange treatment of # and \0), so you might want to add a test to prove they were not broken by your change:
2020-5-7T09:37:00.0000000+00:00\0
#2020-5-7T09:37:00.0000000+00:00#
#2020-5-7T09:37:00.0000000+00:00#\0
I only see tests for these without the timezone part.
These should still fail and aren't tested
2020-5-7T09:37:00.0000000+00:00#
2020-5-7T09:37:00.0000000+00:00#\0
I think your fix is good though - thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I second @danmosemsft for adding more test cases for valid formats. Also, please ensure adding cases when there is nothing at the end too. something like 2020-5-7T09:37:00.0000000-07:00
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danmosemsft @tarekgh Fixed, please review, thanks.
@lateapexearlyspeed did you have a chance to address the feedback on this PR? |
@tarekgh Sorry I am little busy these days, will fix those comment these days. |
@lateapexearlyspeed no problem and thanks again for helping with this one. |
The failure in this PR is unrelated and tracked by the linked issue #32805 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @lateapexearlyspeed for getting this fixed.
Fix #46477