-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(civil): before and after methods for Time #5703
feat(civil): before and after methods for Time #5703
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). For more information, open the CLA check for this pull request. |
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.
@mohamadHarith Sorry about the delay, and thank you for this PR! I have made a few small change requests. Also, I am wondering if your new methods should be included in DateTime.Before
and DateTime.After
? If you modified these methods to compare times in addition to dates, would that be a breaking change? Or could it be seen as a fix (patch)? (The same dates with different times would then return true for one method or the other; I believe they currently return false for both.)
{Time{12, 0, 0, 0}, Time{14, 0, 0, 0}, true}, | ||
{Time{12, 20, 0, 0}, Time{12, 30, 0, 0}, true}, | ||
{Time{12, 20, 10, 0}, Time{12, 20, 20, 0}, true}, | ||
{Time{12, 20, 10, 5}, Time{12, 20, 10, 10}, true}, |
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.
Can you please add a test case for equal times: {Time{12, 20, 10, 5}, Time{12, 20, 10, 5}, false},
{Time{12, 0, 0, 0}, Time{14, 0, 0, 0}, false}, | ||
{Time{12, 20, 0, 0}, Time{12, 30, 0, 0}, false}, | ||
{Time{12, 20, 10, 0}, Time{12, 20, 20, 0}, false}, | ||
{Time{12, 20, 10, 5}, Time{12, 20, 10, 10}, false}, |
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.
Can you please add a test case for equal times: {Time{12, 20, 10, 5}, Time{12, 20, 10, 5}, false},
{Time{12, 20, 10, 5}, Time{12, 20, 10, 10}, false}, | ||
} { | ||
if got := test.t1.After(test.t2); got != test.want { | ||
t.Errorf("%v.Before(%v): got %t, want %t", test.t1, test.t2, got, test.want) |
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.
Before
should be After
in this message.
@codyoss and I discussed this and we agreed that However, you do not need to update |
@mohamadHarith Thank you for this contribution! ❤️ |
I was mistaken, |
closes #5702