commit 585b1029673b6913762c9958a2f048272a145728
parent 1774995ff6484148d9bd42a61c9e0826e212ab3e
Author: André Bargull <andre.bargull@gmail.com>
Date: Mon, 27 Oct 2025 15:18:05 +0000
Bug 1996463: Handle negative zero in time zone offset test. r=spidermonkey-reviewers,jandem
Add `+0` to turn negative zero to positive zero.
Differential Revision: https://phabricator.services.mozilla.com/D270121
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/js/src/tests/non262/Date/realm-time-zone.js b/js/src/tests/non262/Date/realm-time-zone.js
@@ -1,4 +1,4 @@
-// |reftest| skip-if(true||!this.hasOwnProperty('Intl')||!xulRuntime.shell)
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!xulRuntime.shell)
// Don't run in browser because `SpecialPowers.Cu.getJSTestingFunctions()` doesn't
// appear to be able to change time zone in other Realms.
@@ -32,7 +32,7 @@ function test(timeZone) {
// Call getTimeZoneOffset to fill the local date-time slots in |d|.
assertEq(
d.getTimezoneOffset() * nsPerMinute,
- -d.toTemporalInstant().toZonedDateTimeISO(initialTimeZone).offsetNanoseconds
+ -d.toTemporalInstant().toZonedDateTimeISO(initialTimeZone).offsetNanoseconds + 0
);
// Change the time zone of the new global.
@@ -47,7 +47,7 @@ function test(timeZone) {
// Ensure the local date-time slots in |d| don't return stale values.
assertEq(
d.getTimezoneOffset() * nsPerMinute,
- -d.toTemporalInstant().toZonedDateTimeISO("Asia/Tokyo").offsetNanoseconds
+ -d.toTemporalInstant().toZonedDateTimeISO("Asia/Tokyo").offsetNanoseconds + 0
);
// Change the time zone of the new global to use the default time zone.
@@ -59,7 +59,7 @@ function test(timeZone) {
// Ensure the local date-time slots in |d| don't return stale values.
assertEq(
d.getTimezoneOffset() * nsPerMinute,
- -d.toTemporalInstant().toZonedDateTimeISO(defaultTimeZone).offsetNanoseconds
+ -d.toTemporalInstant().toZonedDateTimeISO(defaultTimeZone).offsetNanoseconds + 0
);
}