mirror of https://github.com/tc39/test262.git
Replace Temporal.Now.timeZone → Temporal.Now.timeZoneId
Now.timeZoneId() returns a string so that it can be used to construct objects that have the builtin time zone behaviour. Normative PR: https://github.com/tc39/proposal-temporal/pull/2482
This commit is contained in:
parent
beb4f26eb4
commit
27d7cdad4e
|
@ -1,13 +0,0 @@
|
|||
// 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.timezone
|
||||
description: Each invocation of the function produces a distinct object value
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const tz = Temporal.Now.timeZone;
|
||||
const tz1 = tz();
|
||||
const tz2 = tz();
|
||||
assert.notSameValue(tz1, tz2, 'The value of tz1 is expected to not equal the value of `tz2`');
|
|
@ -1,16 +0,0 @@
|
|||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.timezone
|
||||
description: Temporal.Now.timeZone returns an instance of the TimeZone constructor
|
||||
info: |
|
||||
1. Return ? SystemTimeZone().
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
Object.getPrototypeOf(Temporal.Now.timeZone()),
|
||||
Temporal.TimeZone.prototype,
|
||||
'Object.getPrototypeOf(Temporal.Now.timeZone()) returns Temporal.TimeZone.prototype'
|
||||
);
|
|
@ -2,8 +2,8 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.timezone
|
||||
description: Temporal.Now.timeZone is extensible.
|
||||
esid: sec-temporal.now.timezoneid
|
||||
description: Temporal.Now.timeZoneId is extensible.
|
||||
info: |
|
||||
## 17 ECMAScript Standard Built-in Objects
|
||||
|
||||
|
@ -13,6 +13,6 @@ features: [Temporal]
|
|||
---*/
|
||||
|
||||
assert(
|
||||
Object.isExtensible(Temporal.Now.timeZone),
|
||||
'Object.isExtensible(Temporal.Now.timeZone) must return true'
|
||||
Object.isExtensible(Temporal.Now.timeZoneId),
|
||||
'Object.isExtensible(Temporal.Now.timeZoneId) must return true'
|
||||
);
|
|
@ -2,8 +2,8 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.timezone
|
||||
description: Temporal.Now.timeZone.length is 0
|
||||
esid: sec-temporal.now.timezoneid
|
||||
description: Temporal.Now.timeZoneId.length is 0
|
||||
info: |
|
||||
Every built-in function object, including constructors, has a "length" property whose value is
|
||||
an integer. Unless otherwise specified, this value is equal to the largest number of named
|
||||
|
@ -17,7 +17,7 @@ includes: [propertyHelper.js]
|
|||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
verifyProperty(Temporal.Now.timeZone, "length", {
|
||||
verifyProperty(Temporal.Now.timeZoneId, "length", {
|
||||
value: 0,
|
||||
writable: false,
|
||||
enumerable: false,
|
|
@ -2,8 +2,8 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.timezone
|
||||
description: Temporal.Now.timeZone.name is "timeZone".
|
||||
esid: sec-temporal.now.timezoneid
|
||||
description: Temporal.Now.timeZoneId.name is "timeZoneId".
|
||||
info: |
|
||||
## 17 ECMAScript Standard Built-in Objects:
|
||||
Every built-in Function object, including constructors, that is not
|
||||
|
@ -18,12 +18,12 @@ features: [Temporal]
|
|||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
Temporal.Now.timeZone.name,
|
||||
'timeZone',
|
||||
'The value of Temporal.Now.timeZone.name is expected to be "timeZone"'
|
||||
Temporal.Now.timeZoneId.name,
|
||||
'timeZoneId',
|
||||
'The value of Temporal.Now.timeZoneId.name is expected to be "timeZoneId"'
|
||||
);
|
||||
|
||||
verifyProperty(Temporal.Now.timeZone, 'name', {
|
||||
verifyProperty(Temporal.Now.timeZoneId, 'name', {
|
||||
enumerable: false,
|
||||
writable: false,
|
||||
configurable: true
|
|
@ -2,8 +2,8 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.timezone
|
||||
description: Temporal.Now.timeZone does not implement [[Construct]]
|
||||
esid: sec-temporal.now.timezoneid
|
||||
description: Temporal.Now.timeZoneId does not implement [[Construct]]
|
||||
info: |
|
||||
ECMAScript Function Objects
|
||||
|
||||
|
@ -14,8 +14,8 @@ includes: [isConstructor.js]
|
|||
features: [Reflect.construct, Temporal, arrow-function]
|
||||
---*/
|
||||
|
||||
assert.sameValue(isConstructor(Temporal.Now.timeZone), false, 'isConstructor(Temporal.Now.timeZone) must return false');
|
||||
assert.sameValue(isConstructor(Temporal.Now.timeZoneId), false, 'isConstructor(Temporal.Now.timeZoneId) must return false');
|
||||
|
||||
assert.throws(TypeError, () => {
|
||||
new Temporal.Now.timeZone();
|
||||
}, 'new Temporal.Now.timeZone() throws a TypeError exception');
|
||||
new Temporal.Now.timeZoneId();
|
||||
}, 'new Temporal.Now.timeZoneId() throws a TypeError exception');
|
|
@ -2,8 +2,8 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.timezone
|
||||
description: The "timeZone" property of Temporal.Now
|
||||
esid: sec-temporal.now.timezoneid
|
||||
description: The "timeZoneId" property of Temporal.Now
|
||||
info: |
|
||||
Section 17: Every other data property described in clauses 18 through 26
|
||||
and in Annex B.2 has the attributes { [[Writable]]: true,
|
||||
|
@ -12,9 +12,9 @@ includes: [propertyHelper.js]
|
|||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
assert.sameValue(typeof Temporal.Now.timeZone, "function", "typeof is function");
|
||||
assert.sameValue(typeof Temporal.Now.timeZoneId, "function", "typeof is function");
|
||||
|
||||
verifyProperty(Temporal.Now, 'timeZone', {
|
||||
verifyProperty(Temporal.Now, 'timeZoneId', {
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2021 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.now.timezoneid
|
||||
description: Temporal.Now.timeZoneId returns a string
|
||||
info: |
|
||||
1. Return DefaultTimeZone().
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
assert.sameValue(
|
||||
typeof Temporal.Now.timeZoneId(),
|
||||
"string",
|
||||
"Temporal.Now.timeZoneId() returns a string"
|
||||
);
|
|
@ -18,14 +18,14 @@ Object.defineProperty(Temporal.TimeZone, "from", {
|
|||
},
|
||||
});
|
||||
|
||||
const systemTimeZone = Temporal.Now.timeZone();
|
||||
const systemTimeZone = Temporal.Now.timeZoneId();
|
||||
|
||||
const resultExplicit = Temporal.Now.zonedDateTime('iso8601', undefined);
|
||||
assert.sameValue(resultExplicit.timeZone.id, systemTimeZone.id);
|
||||
assert.sameValue(resultExplicit.timeZone.id, systemTimeZone);
|
||||
|
||||
assert.compareArray(actual, expected, "Temporal.TimeZone.from should not be called");
|
||||
|
||||
const resultImplicit = Temporal.Now.zonedDateTime('iso8601');
|
||||
assert.sameValue(resultImplicit.timeZone.id, systemTimeZone.id);
|
||||
assert.sameValue(resultImplicit.timeZone.id, systemTimeZone);
|
||||
|
||||
assert.compareArray(actual, expected, "Temporal.TimeZone.from should not be called");
|
||||
|
|
|
@ -8,9 +8,9 @@ features: [Temporal]
|
|||
---*/
|
||||
|
||||
const zdt = Temporal.Now.zonedDateTimeISO();
|
||||
const tz = Temporal.Now.timeZone();
|
||||
const tz = Temporal.Now.timeZoneId();
|
||||
assert(zdt instanceof Temporal.ZonedDateTime);
|
||||
assert(zdt.calendar instanceof Temporal.Calendar);
|
||||
assert.sameValue(zdt.calendar.id, "iso8601");
|
||||
assert(zdt.timeZone instanceof Temporal.TimeZone);
|
||||
assert.sameValue(zdt.timeZone.id, tz.id);
|
||||
assert.sameValue(zdt.timeZone.id, tz);
|
||||
|
|
|
@ -18,14 +18,14 @@ Object.defineProperty(Temporal.TimeZone, "from", {
|
|||
},
|
||||
});
|
||||
|
||||
const systemTimeZone = Temporal.Now.timeZone();
|
||||
const systemTimeZone = Temporal.Now.timeZoneId();
|
||||
|
||||
const resultExplicit = Temporal.Now.zonedDateTimeISO(undefined);
|
||||
assert.sameValue(resultExplicit.timeZone.id, systemTimeZone.id);
|
||||
assert.sameValue(resultExplicit.timeZone.id, systemTimeZone);
|
||||
|
||||
assert.compareArray(actual, expected, "Temporal.TimeZone.from should not be called");
|
||||
|
||||
const resultImplicit = Temporal.Now.zonedDateTimeISO();
|
||||
assert.sameValue(resultImplicit.timeZone.id, systemTimeZone.id);
|
||||
assert.sameValue(resultImplicit.timeZone.id, systemTimeZone);
|
||||
|
||||
assert.compareArray(actual, expected, "Temporal.TimeZone.from should not be called");
|
||||
|
|
|
@ -8,10 +8,10 @@ features: [Temporal]
|
|||
---*/
|
||||
|
||||
const zdt = Temporal.Now.zonedDateTime("gregory");
|
||||
const tz = Temporal.Now.timeZone();
|
||||
const tz = Temporal.Now.timeZoneId();
|
||||
assert(zdt instanceof Temporal.ZonedDateTime);
|
||||
assert(zdt.calendar instanceof Temporal.Calendar);
|
||||
assert.sameValue(zdt.calendar.id, "gregory");
|
||||
assert(zdt.timeZone instanceof Temporal.TimeZone);
|
||||
assert.sameValue(zdt.timeZone.id, tz.id);
|
||||
assert.sameValue(zdt.timeZone.id, tz);
|
||||
|
||||
|
|
Loading…
Reference in New Issue