Skip to content
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

IsSame() and similar functions #40

Closed
jftuga opened this issue Apr 23, 2021 · 0 comments · Fixed by #42
Closed

IsSame() and similar functions #40

jftuga opened this issue Apr 23, 2021 · 0 comments · Fixed by #42
Assignees
Labels
bug Something isn't working

Comments

@jftuga
Copy link

jftuga commented Apr 23, 2021

Could you please update the documentation for IsSame() and its similar functions?

I noticed that this will not always return the correct result:

// d1 and d2 are both of type goment.Goment
d1.IsSameOrBefore(d2)

In order to fix this, I had to use this instead:

d1.IsSameOrBefore(&d1)

In the first example, false could be returned when true should be returned because of this section of code:

switch v := args[0].(type) {

This switch statement never checks for type Goment -- only for type *Goment. Therefore, false is returned without comparing the dates.

In addition to updating the documentation, you could have the switch statement also check for a Goment type.

@nleeper nleeper added the bug Something isn't working label Apr 27, 2021
@nleeper nleeper self-assigned this Apr 27, 2021
@nleeper nleeper linked a pull request Jun 8, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants