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
the isBefore
method is nondeterministic
#4536
Comments
It looks like isBefore is behaving correctly but somehow the two moment() objects are sometimes created with the second one having the earlier date. This is the check that's returning disparate results: |
I see, thanks for looking into it and getting back to me! |
I think it depends on the exact millisecond the moments are created. The fact that the second is ever created after the first feels like a browser bug. There is a more extensive conversation around this topic here: #2697 |
Looks fine to me. Compare You wouldn't expect or want All that to say: |
@ispacowanguitar some of the time the moments are created in the same millisecond, some of the time not. Nothing to see here. |
I found this while working on a calendar that needs to disable certain date ranges. It is sometimes off by one.
To reproduce:
moment().isBefore(moment())
Run it over and over again, it should always be
false
, but sometimes showstrue
. This does not appear to happen with theisAfter
method. Below is a screenshot.The text was updated successfully, but these errors were encountered: