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

1.4.1: Date.isThisAny() fails in Opera Mini #496

Closed
ermouth opened this issue May 13, 2015 · 7 comments
Closed

1.4.1: Date.isThisAny() fails in Opera Mini #496

ermouth opened this issue May 13, 2015 · 7 comments
Milestone

Comments

@ermouth
Copy link

ermouth commented May 13, 2015

Methods .isThisYear, .isThisWeek, .isThisMonth throw error in Opera Mini on at least iPhone. Method .isToday and similar work fine although.

@andrewplummer
Copy link
Owner

Thank you for this report (and sorry it took so long).

I would love to look into this issue, but debugging seems basically impossible for Opera Mini, as actual rendering/execution isn't performed on the client, no? If you have a good way to debug this I'm all ears.

@ermouth
Copy link
Author

ermouth commented Jul 13, 2015

Sugar is perfect, so you can visit issue page once a year – and see nearly no changes, so no need to sorry )

Debugging Opera-Mini is a pain. The only more or less reliable way is using server:console?your.url.goes/here to see console. So debugging is just going step by step, reloading page and reading messages.

Please note, that OM console is unable to show objects in readable way, they all look like [object Object] in printout.

@andrewplummer
Copy link
Owner

Ok wow I guess that's the only way. I'll see what I can set up on the site and then have a look.

@andrewplummer
Copy link
Owner

OK I've managed to set up a way to debug this... lots of fun.
It seems that the main cause of the bug was the modulo operator on non-numbers:

undefined % 1; // -2147483648
NaN % 1; //  -2147483648
1 % undefined; //  -2147483648

Seems to produce something ridiculous (MIN_SAFE_INTEGER??). There was a critical path in the date code that ended up being undefined % 1, so this was skewing all dates. I've fixed the issue and also swept through the entire codebase for other possible modulo bugs. This particular bug should be OK now but it's pretty much impossible for me at this point to run the unit tests on OM, so might have to think about that one going forward.

@ermouth
Copy link
Author

ermouth commented Sep 29, 2015

Wonderful!

Seems to produce something ridiculous

Modulo produces ridiculous results in other browsers also. -10%3 >> -1, but valid result is 2. So to get arithmetically valid result (num).mod(div) should be smth like (num % div + div) % div. Got a lot of pain from it once.

@andrewplummer
Copy link
Owner

Yikes... sounds crazy. Anyway I'll have another more comprehensive check when I have more time later.

andrewplummer added a commit that referenced this issue Jul 24, 2016
Former-commit-id: f3bf901427bb58dfbef6b665c124f5fe9ec019cb [formerly 16f20748e80ee4dd3d4ca0af69204e8445c7c78f]
Former-commit-id: 5998962355b3ba425fcdf66af301f29896f6f1da
andrewplummer added a commit that referenced this issue Jul 24, 2016
Former-commit-id: c08ed96
Former-commit-id: 3033ba3c68466857878f91c8619c071a7a4bfdfb
@andrewplummer
Copy link
Owner

Note here that I did a final sweep of modulo operators on undefined just before releasing 2.0.0 to avoid this issue elsewhere. Will make sure to continue this in the future as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants