mirror of https://github.com/tc39/test262.git
32 lines
1.0 KiB
JavaScript
32 lines
1.0 KiB
JavaScript
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
esid: sec-temporal.now.plaintimeiso
|
|
description: The value returned by TimeZone.getOffsetNanosecondsFor affects the result
|
|
includes: [compareArray.js, temporalHelpers.js]
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
const actual = [];
|
|
const expected = [
|
|
"has timeZone.timeZone",
|
|
"get timeZone.getOffsetNanosecondsFor",
|
|
"call timeZone.getOffsetNanosecondsFor",
|
|
];
|
|
|
|
const timeZone = TemporalHelpers.timeZoneObserver(actual, "timeZone", {
|
|
getOffsetNanosecondsFor(instant) {
|
|
assert.sameValue(instant instanceof Temporal.Instant, true, "Instant");
|
|
return -Number(instant.epochNanoseconds % 86400_000_000_000n);
|
|
},
|
|
});
|
|
|
|
const result = Temporal.Now.plainTimeISO(timeZone);
|
|
assert.sameValue(result instanceof Temporal.PlainTime, true);
|
|
for (const property of ["hour", "minute", "second", "millisecond", "microsecond", "nanosecond"]) {
|
|
assert.sameValue(result[property], 0, property);
|
|
}
|
|
|
|
assert.compareArray(actual, expected);
|