We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
getTimezoneOffset
-0
Steps to reproduce:
import timezoneMock from 'timezone-mock'; timezoneMock.register('UTC'); new Date().getTimezoneOffset(); // returns -0
this causes issues when using jest because toEqual uses Object.is under the hood, so this assertion fails:
toEqual
Object.is
timezoneMock.register('UTC'); const offset = new Date().getTimezoneOffset(); expect(offset).toEqual(0); // fails because Object.is(-0, 0) return false
and instead an ugly workaround is required:
expect(offset === 0).toBe(true);
I'd expect getTimezoneOffset to return 0 for UTC instead of -0 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset#negative_values_and_positive_values
0
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Steps to reproduce:
this causes issues when using jest because
toEqual
usesObject.is
under the hood, so this assertion fails:and instead an ugly workaround is required:
I'd expect
getTimezoneOffset
to return0
for UTC instead of-0
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset#negative_values_and_positive_values
The text was updated successfully, but these errors were encountered: