-
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
civil: add Compare method to Date, Time and DateTime #10009
Comments
Just reviewed the PR. Thanks for the idea/contribution. |
@shota3506 sorry, need to hold onto this for a little bit. We want to upgrade to Go 1.20 soon. Please reopen your PR after the reversion goes through and we will merge it as soon as we upgrade! |
@noahdietz Thank you for your review and comment! |
Hi ✋ I've reopened the PR #10193 |
Yes @shota3506 good eye :) Thanks! |
Is your feature request related to a problem? Please describe.
This proposal suggests adding
Compare
method to civil.Date, civil.Time and civil.DateTimeSome structs in the standard package have
Compare
method which returns a integer value of either -1, +1, or 0.https://pkg.go.dev/time#Time.Compare
https://pkg.go.dev/net/netip@master#Addr.Compare
It looks like the standard way to define ordered objects in Go (golang/go#50770 (comment)), and it is useful when we sort such objects by slices.SortFunc.
Describe the solution you'd like
I'll open a PR for this issue soon.
Describe alternatives you've considered
Of course, we can judge the order of civil objects by using exiting
After
andBefore
.If there are opinions that it is unnecessary, I will respect them.
Additional context
The text was updated successfully, but these errors were encountered: