diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/branding.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/branding.js deleted file mode 100644 index 9b629ee6e5e..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/branding.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const getNextTransition = Temporal.TimeZone.prototype.getNextTransition; - -assert.sameValue(typeof getNextTransition, "function"); - -const args = [new Temporal.Instant(0n)]; - -assert.throws(TypeError, () => getNextTransition.apply(undefined, args), "undefined"); -assert.throws(TypeError, () => getNextTransition.apply(null, args), "null"); -assert.throws(TypeError, () => getNextTransition.apply(true, args), "true"); -assert.throws(TypeError, () => getNextTransition.apply("", args), "empty string"); -assert.throws(TypeError, () => getNextTransition.apply(Symbol(), args), "symbol"); -assert.throws(TypeError, () => getNextTransition.apply(1, args), "1"); -assert.throws(TypeError, () => getNextTransition.apply({}, args), "plain object"); -assert.throws(TypeError, () => getNextTransition.apply(Temporal.TimeZone, args), "Temporal.TimeZone"); -assert.throws(TypeError, () => getNextTransition.apply(Temporal.TimeZone.prototype, args), "Temporal.TimeZone.prototype"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/prop-desc.js b/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/prop-desc.js deleted file mode 100644 index 975d1bfd716..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/prop-desc.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: The "getNextTransition" property of Temporal.TimeZone.prototype -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -assert.sameValue( - typeof Temporal.TimeZone.prototype.getNextTransition, - "function", - "`typeof TimeZone.prototype.getNextTransition` is `function`" -); - -verifyProperty(Temporal.TimeZone.prototype, "getNextTransition", { - writable: true, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/branding.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/branding.js deleted file mode 100644 index 75e4164e4dd..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/branding.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Throw a TypeError if the receiver is invalid -features: [Symbol, Temporal] ----*/ - -const getPreviousTransition = Temporal.TimeZone.prototype.getPreviousTransition; - -assert.sameValue(typeof getPreviousTransition, "function"); - -const args = [new Temporal.Instant(0n)]; - -assert.throws(TypeError, () => getPreviousTransition.apply(undefined, args), "undefined"); -assert.throws(TypeError, () => getPreviousTransition.apply(null, args), "null"); -assert.throws(TypeError, () => getPreviousTransition.apply(true, args), "true"); -assert.throws(TypeError, () => getPreviousTransition.apply("", args), "empty string"); -assert.throws(TypeError, () => getPreviousTransition.apply(Symbol(), args), "symbol"); -assert.throws(TypeError, () => getPreviousTransition.apply(1, args), "1"); -assert.throws(TypeError, () => getPreviousTransition.apply({}, args), "plain object"); -assert.throws(TypeError, () => getPreviousTransition.apply(Temporal.TimeZone, args), "Temporal.TimeZone"); -assert.throws(TypeError, () => getPreviousTransition.apply(Temporal.TimeZone.prototype, args), "Temporal.TimeZone.prototype"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/prop-desc.js b/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/prop-desc.js deleted file mode 100644 index a2e3c75e5bb..00000000000 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/prop-desc.js +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2021 Igalia, S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: The "getPreviousTransition" property of Temporal.TimeZone.prototype -includes: [propertyHelper.js] -features: [Temporal] ----*/ - -assert.sameValue( - typeof Temporal.TimeZone.prototype.getPreviousTransition, - "function", - "`typeof TimeZone.prototype.getPreviousTransition` is `function`" -); - -verifyProperty(Temporal.TimeZone.prototype, "getPreviousTransition", { - writable: true, - enumerable: false, - configurable: true, -}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/branding.js b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/branding.js new file mode 100644 index 00000000000..bf078719e31 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/branding.js @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.nexttransition +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const nextTransition = Temporal.ZonedDateTime.prototype.nextTransition; + +assert.sameValue(typeof nextTransition, "function"); + +const args = []; + +assert.throws(TypeError, () => nextTransition.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => nextTransition.apply(null, args), "null"); +assert.throws(TypeError, () => nextTransition.apply(true, args), "true"); +assert.throws(TypeError, () => nextTransition.apply("", args), "empty string"); +assert.throws(TypeError, () => nextTransition.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => nextTransition.apply(1, args), "1"); +assert.throws(TypeError, () => nextTransition.apply({}, args), "plain object"); +assert.throws(TypeError, () => nextTransition.apply(Temporal.ZonedDateTime, args), "Temporal.ZonedDateTime"); +assert.throws(TypeError, () => nextTransition.apply(Temporal.ZonedDateTime.prototype, args), "Temporal.ZonedDateTime.prototype"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/builtin.js b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/builtin.js similarity index 69% rename from test/built-ins/Temporal/TimeZone/prototype/getNextTransition/builtin.js rename to test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/builtin.js index 4964f48b53b..f155a71171f 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/builtin.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/builtin.js @@ -2,9 +2,9 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-temporal.timezone.prototype.getnexttransition +esid: sec-temporal.zoneddatetime.prototype.nexttransition description: > - Tests that Temporal.TimeZone.prototype.getNextTransition + Tests that Temporal.ZonedDateTime.prototype.nextTransition meets the requirements for built-in objects defined by the introduction of chapter 17 of the ECMAScript Language Specification. info: | @@ -20,14 +20,14 @@ info: | features: [Temporal] ---*/ -assert.sameValue(Object.isExtensible(Temporal.TimeZone.prototype.getNextTransition), +assert.sameValue(Object.isExtensible(Temporal.ZonedDateTime.prototype.nextTransition), true, "Built-in objects must be extensible."); -assert.sameValue(Object.prototype.toString.call(Temporal.TimeZone.prototype.getNextTransition), +assert.sameValue(Object.prototype.toString.call(Temporal.ZonedDateTime.prototype.nextTransition), "[object Function]", "Object.prototype.toString"); -assert.sameValue(Object.getPrototypeOf(Temporal.TimeZone.prototype.getNextTransition), +assert.sameValue(Object.getPrototypeOf(Temporal.ZonedDateTime.prototype.nextTransition), Function.prototype, "prototype"); -assert.sameValue(Temporal.TimeZone.prototype.getNextTransition.hasOwnProperty("prototype"), +assert.sameValue(Temporal.ZonedDateTime.prototype.nextTransition.hasOwnProperty("prototype"), false, "prototype property"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/length.js b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/length.js similarity index 80% rename from test/built-ins/Temporal/TimeZone/prototype/getNextTransition/length.js rename to test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/length.js index 248f2416f19..549404d71f3 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/length.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/length.js @@ -2,8 +2,8 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Temporal.TimeZone.prototype.getNextTransition.length is 1 +esid: sec-temporal.zoneddatetime.prototype.nexttransition +description: Temporal.ZonedDateTime.prototype.nextTransition.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,8 +17,8 @@ includes: [propertyHelper.js] features: [Temporal] ---*/ -verifyProperty(Temporal.TimeZone.prototype.getNextTransition, "length", { - value: 1, +verifyProperty(Temporal.ZonedDateTime.prototype.nextTransition, "length", { + value: 0, writable: false, enumerable: false, configurable: true, diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/name.js b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/name.js similarity index 74% rename from test/built-ins/Temporal/TimeZone/prototype/getNextTransition/name.js rename to test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/name.js index 0fdb93d632c..21d43d69fc4 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/name.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/name.js @@ -2,8 +2,8 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: Temporal.TimeZone.prototype.getNextTransition.name is "getNextTransition". +esid: sec-temporal.zoneddatetime.prototype.nexttransition +description: Temporal.ZonedDateTime.prototype.nextTransition.name is "nextTransition". info: | Every built-in function object, including constructors, that is not identified as an anonymous function has a "name" property whose value is a String. Unless otherwise specified, this value @@ -15,8 +15,8 @@ includes: [propertyHelper.js] features: [Temporal] ---*/ -verifyProperty(Temporal.TimeZone.prototype.getNextTransition, "name", { - value: "getNextTransition", +verifyProperty(Temporal.ZonedDateTime.prototype.nextTransition, "name", { + value: "nextTransition", writable: false, enumerable: false, configurable: true, diff --git a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/not-a-constructor.js b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/not-a-constructor.js similarity index 57% rename from test/built-ins/Temporal/TimeZone/prototype/getNextTransition/not-a-constructor.js rename to test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/not-a-constructor.js index 5c57f04f86a..b98b245760c 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getNextTransition/not-a-constructor.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/not-a-constructor.js @@ -2,9 +2,9 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-temporal.timezone.prototype.getnexttransition +esid: sec-temporal.zoneddatetime.prototype.nexttransition description: > - Temporal.TimeZone.prototype.getNextTransition does not implement [[Construct]], is not new-able + Temporal.ZonedDateTime.prototype.nextTransition does not implement [[Construct]], is not new-able info: | Built-in function objects that are not identified as constructors do not implement the [[Construct]] internal method unless otherwise specified in the description of a particular @@ -14,8 +14,8 @@ features: [Reflect.construct, Temporal] ---*/ assert.throws(TypeError, () => { - new Temporal.TimeZone.prototype.getNextTransition(); + new Temporal.ZonedDateTime.prototype.nextTransition(); }, "Calling as constructor"); -assert.sameValue(isConstructor(Temporal.TimeZone.prototype.getNextTransition), false, - "isConstructor(Temporal.TimeZone.prototype.getNextTransition)"); +assert.sameValue(isConstructor(Temporal.ZonedDateTime.prototype.nextTransition), false, + "isConstructor(Temporal.ZonedDateTime.prototype.nextTransition)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/prop-desc.js b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/prop-desc.js new file mode 100644 index 00000000000..5f04b08e1a3 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/nextTransition/prop-desc.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.nexttransition +description: The "nextTransition" property of Temporal.ZonedDateTime.prototype +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue( + typeof Temporal.ZonedDateTime.prototype.nextTransition, + "function", + "`typeof ZonedDateTime.prototype.nextTransition` is `function`" +); + +verifyProperty(Temporal.ZonedDateTime.prototype, "nextTransition", { + writable: true, + enumerable: false, + configurable: true, +}); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/branding.js b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/branding.js new file mode 100644 index 00000000000..7f194d133f0 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/branding.js @@ -0,0 +1,24 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.previoustransition +description: Throw a TypeError if the receiver is invalid +features: [Symbol, Temporal] +---*/ + +const previousTransition = Temporal.ZonedDateTime.prototype.previousTransition; + +assert.sameValue(typeof previousTransition, "function"); + +const args = []; + +assert.throws(TypeError, () => previousTransition.apply(undefined, args), "undefined"); +assert.throws(TypeError, () => previousTransition.apply(null, args), "null"); +assert.throws(TypeError, () => previousTransition.apply(true, args), "true"); +assert.throws(TypeError, () => previousTransition.apply("", args), "empty string"); +assert.throws(TypeError, () => previousTransition.apply(Symbol(), args), "symbol"); +assert.throws(TypeError, () => previousTransition.apply(1, args), "1"); +assert.throws(TypeError, () => previousTransition.apply({}, args), "plain object"); +assert.throws(TypeError, () => previousTransition.apply(Temporal.ZonedDateTime, args), "Temporal.ZonedDateTime"); +assert.throws(TypeError, () => previousTransition.apply(Temporal.ZonedDateTime.prototype, args), "Temporal.ZonedDateTime.prototype"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/builtin.js b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/builtin.js similarity index 68% rename from test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/builtin.js rename to test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/builtin.js index 4fc7ff1c311..449c0209b4c 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/builtin.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/builtin.js @@ -2,9 +2,9 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-temporal.timezone.prototype.getprevioustransition +esid: sec-temporal.zoneddatetime.prototype.previoustransition description: > - Tests that Temporal.TimeZone.prototype.getPreviousTransition + Tests that Temporal.ZonedDateTime.prototype.previousTransition meets the requirements for built-in objects defined by the introduction of chapter 17 of the ECMAScript Language Specification. info: | @@ -20,14 +20,14 @@ info: | features: [Temporal] ---*/ -assert.sameValue(Object.isExtensible(Temporal.TimeZone.prototype.getPreviousTransition), +assert.sameValue(Object.isExtensible(Temporal.ZonedDateTime.prototype.previousTransition), true, "Built-in objects must be extensible."); -assert.sameValue(Object.prototype.toString.call(Temporal.TimeZone.prototype.getPreviousTransition), +assert.sameValue(Object.prototype.toString.call(Temporal.ZonedDateTime.prototype.previousTransition), "[object Function]", "Object.prototype.toString"); -assert.sameValue(Object.getPrototypeOf(Temporal.TimeZone.prototype.getPreviousTransition), +assert.sameValue(Object.getPrototypeOf(Temporal.ZonedDateTime.prototype.previousTransition), Function.prototype, "prototype"); -assert.sameValue(Temporal.TimeZone.prototype.getPreviousTransition.hasOwnProperty("prototype"), +assert.sameValue(Temporal.ZonedDateTime.prototype.previousTransition.hasOwnProperty("prototype"), false, "prototype property"); diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/length.js b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/length.js similarity index 79% rename from test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/length.js rename to test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/length.js index 83cb3c8abe2..45130e3bace 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/length.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/length.js @@ -2,8 +2,8 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Temporal.TimeZone.prototype.getPreviousTransition.length is 1 +esid: sec-temporal.zoneddatetime.prototype.previoustransition +description: Temporal.ZonedDateTime.prototype.previousTransition.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,8 +17,8 @@ includes: [propertyHelper.js] features: [Temporal] ---*/ -verifyProperty(Temporal.TimeZone.prototype.getPreviousTransition, "length", { - value: 1, +verifyProperty(Temporal.ZonedDateTime.prototype.previousTransition, "length", { + value: 0, writable: false, enumerable: false, configurable: true, diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/name.js b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/name.js similarity index 73% rename from test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/name.js rename to test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/name.js index 0dc22a2a50e..6becf507306 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/name.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/name.js @@ -2,8 +2,8 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: Temporal.TimeZone.prototype.getPreviousTransition.name is "getPreviousTransition". +esid: sec-temporal.zoneddatetime.prototype.previoustransition +description: Temporal.ZonedDateTime.prototype.previousTransition.name is "previousTransition". info: | Every built-in function object, including constructors, that is not identified as an anonymous function has a "name" property whose value is a String. Unless otherwise specified, this value @@ -15,8 +15,8 @@ includes: [propertyHelper.js] features: [Temporal] ---*/ -verifyProperty(Temporal.TimeZone.prototype.getPreviousTransition, "name", { - value: "getPreviousTransition", +verifyProperty(Temporal.ZonedDateTime.prototype.previousTransition, "name", { + value: "previousTransition", writable: false, enumerable: false, configurable: true, diff --git a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/not-a-constructor.js b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/not-a-constructor.js similarity index 55% rename from test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/not-a-constructor.js rename to test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/not-a-constructor.js index 12f2d39e183..b584c5d6758 100644 --- a/test/built-ins/Temporal/TimeZone/prototype/getPreviousTransition/not-a-constructor.js +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/not-a-constructor.js @@ -2,9 +2,9 @@ // This code is governed by the BSD license found in the LICENSE file. /*--- -esid: sec-temporal.timezone.prototype.getprevioustransition +esid: sec-temporal.zoneddatetime.prototype.previoustransition description: > - Temporal.TimeZone.prototype.getPreviousTransition does not implement [[Construct]], is not new-able + Temporal.ZonedDateTime.prototype.previousTransition does not implement [[Construct]], is not new-able info: | Built-in function objects that are not identified as constructors do not implement the [[Construct]] internal method unless otherwise specified in the description of a particular @@ -14,8 +14,8 @@ features: [Reflect.construct, Temporal] ---*/ assert.throws(TypeError, () => { - new Temporal.TimeZone.prototype.getPreviousTransition(); + new Temporal.ZonedDateTime.prototype.previousTransition(); }, "Calling as constructor"); -assert.sameValue(isConstructor(Temporal.TimeZone.prototype.getPreviousTransition), false, - "isConstructor(Temporal.TimeZone.prototype.getPreviousTransition)"); +assert.sameValue(isConstructor(Temporal.ZonedDateTime.prototype.previousTransition), false, + "isConstructor(Temporal.ZonedDateTime.prototype.previousTransition)"); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/prop-desc.js b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/prop-desc.js new file mode 100644 index 00000000000..2bf337f6d1b --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/previousTransition/prop-desc.js @@ -0,0 +1,21 @@ +// Copyright (C) 2021 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.previoustransition +description: The "previousTransition" property of Temporal.ZonedDateTime.prototype +includes: [propertyHelper.js] +features: [Temporal] +---*/ + +assert.sameValue( + typeof Temporal.ZonedDateTime.prototype.previousTransition, + "function", + "`typeof ZonedDateTime.prototype.previousTransition` is `function`" +); + +verifyProperty(Temporal.ZonedDateTime.prototype, "previousTransition", { + writable: true, + enumerable: false, + configurable: true, +}); diff --git a/test/intl402/Temporal/TimeZone/prototype/getNextTransition/subtract-second-and-nanosecond-from-last-transition.js b/test/intl402/Temporal/TimeZone/prototype/getNextTransition/subtract-second-and-nanosecond-from-last-transition.js deleted file mode 100644 index 1ace980f8bc..00000000000 --- a/test/intl402/Temporal/TimeZone/prototype/getNextTransition/subtract-second-and-nanosecond-from-last-transition.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2022 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: > - Compute next transition when seconds resp. nanoseconds are subtracted from the last transition. -features: [Temporal] ----*/ - -// From : -// -// # Zone NAME STDOFF RULES FORMAT [UNTIL] -// Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01 -// 0:09:21 - PMT 1911 Mar 11 0:01 # Paris MT - -let tz = new Temporal.TimeZone("Europe/Paris"); - -let zdt = new Temporal.PlainDateTime(1800, 1, 1).toZonedDateTime(tz); -assert.sameValue(zdt.toString(), "1800-01-01T00:00:00+00:09[Europe/Paris]"); -assert.sameValue(zdt.offsetNanoseconds, (9 * 60 + 21) * 1_000_000_000); - -// Ensure the first transition was correctly computed. -let first = tz.getNextTransition(zdt); -assert.sameValue(first.toString(), "1911-03-10T23:50:39Z"); -assert.sameValue(new Temporal.ZonedDateTime(first.epochNanoseconds, tz).toString(), - "1911-03-10T23:50:39+00:00[Europe/Paris]"); - -let next; - -// Compute the next transition starting from the first transition minus 1s. -let firstMinus1s = first.add({seconds: -1}); -assert.sameValue(firstMinus1s.toString(), "1911-03-10T23:50:38Z"); -assert.sameValue(new Temporal.ZonedDateTime(firstMinus1s.epochNanoseconds, tz).toString(), - "1911-03-10T23:59:59+00:09[Europe/Paris]"); -assert.sameValue(new Temporal.ZonedDateTime(firstMinus1s.epochNanoseconds, tz).offsetNanoseconds, - (9 * 60 + 21) * 1_000_000_000); - -next = tz.getNextTransition(firstMinus1s); -assert.sameValue(next.toString(), "1911-03-10T23:50:39Z"); -assert.sameValue(new Temporal.ZonedDateTime(next.epochNanoseconds, tz).toString(), - "1911-03-10T23:50:39+00:00[Europe/Paris]"); - -// Compute the next transition starting from the first transition minus 1ns. -let firstMinus1ns = first.add({nanoseconds: -1}); -assert.sameValue(firstMinus1ns.toString(), "1911-03-10T23:50:38.999999999Z"); -assert.sameValue(new Temporal.ZonedDateTime(firstMinus1ns.epochNanoseconds, tz).toString(), - "1911-03-10T23:59:59.999999999+00:09[Europe/Paris]"); -assert.sameValue(new Temporal.ZonedDateTime(firstMinus1ns.epochNanoseconds, tz).offsetNanoseconds, - (9 * 60 + 21) * 1_000_000_000); - -next = tz.getNextTransition(firstMinus1ns); -assert.sameValue(next.toString(), "1911-03-10T23:50:39Z"); -assert.sameValue(new Temporal.ZonedDateTime(next.epochNanoseconds, tz).toString(), - "1911-03-10T23:50:39+00:00[Europe/Paris]"); diff --git a/test/intl402/Temporal/TimeZone/prototype/getNextTransition/transition-at-instant-boundaries.js b/test/intl402/Temporal/TimeZone/prototype/getNextTransition/transition-at-instant-boundaries.js deleted file mode 100644 index d909b666422..00000000000 --- a/test/intl402/Temporal/TimeZone/prototype/getNextTransition/transition-at-instant-boundaries.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2022 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getnexttransition -description: > - Test transitions at the instant boundaries. -features: [Temporal, Intl-enumeration] ----*/ - -const min = new Temporal.Instant(-86_40000_00000_00000_00000n); -const max = new Temporal.Instant(86_40000_00000_00000_00000n); - -for (let id of Intl.supportedValuesOf("timeZone")) { - let tz = new Temporal.TimeZone(id); - - // If there's any next transition, it should be after |min|. - let next = tz.getNextTransition(min); - if (next) { - assert(next.epochNanoseconds > min.epochNanoseconds); - } - - // There shouldn't be any next transition after |max|. - next = tz.getNextTransition(max); - assert.sameValue(next, null); -} diff --git a/test/intl402/Temporal/TimeZone/prototype/getPreviousTransition/nanoseconds-subtracted-or-added-at-dst-transition.js b/test/intl402/Temporal/TimeZone/prototype/getPreviousTransition/nanoseconds-subtracted-or-added-at-dst-transition.js deleted file mode 100644 index fd5a8606246..00000000000 --- a/test/intl402/Temporal/TimeZone/prototype/getPreviousTransition/nanoseconds-subtracted-or-added-at-dst-transition.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (C) 2022 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: > - Test previous transition when nanoseconds are subtracted resp. added to the DST transition. -features: [Temporal] ----*/ - -let tz = new Temporal.TimeZone("Europe/Berlin"); -let p = Temporal.Instant.from("2021-03-28T01:00:00Z"); - -assert.sameValue(tz.getPreviousTransition(p.add({nanoseconds: -1})).toString(), - "2020-10-25T01:00:00Z", - "DST transition minus one nanosecond"); - -assert.sameValue(tz.getPreviousTransition(p).toString(), - "2020-10-25T01:00:00Z", - "DST transition"); - -assert.sameValue(tz.getPreviousTransition(p.add({nanoseconds: +1})).toString(), - "2021-03-28T01:00:00Z", - "DST transition plus one nanosecond"); diff --git a/test/intl402/Temporal/TimeZone/prototype/getPreviousTransition/transition-at-instant-boundaries.js b/test/intl402/Temporal/TimeZone/prototype/getPreviousTransition/transition-at-instant-boundaries.js deleted file mode 100644 index c2f149bb6a2..00000000000 --- a/test/intl402/Temporal/TimeZone/prototype/getPreviousTransition/transition-at-instant-boundaries.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (C) 2022 André Bargull. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-temporal.timezone.prototype.getprevioustransition -description: > - Test transitions at the instant boundaries. -features: [Temporal, Intl-enumeration] ----*/ - -const min = new Temporal.Instant(-86_40000_00000_00000_00000n); -const max = new Temporal.Instant(86_40000_00000_00000_00000n); - -for (let id of Intl.supportedValuesOf("timeZone")) { - let tz = new Temporal.TimeZone(id); - - // If there's any previous transition, it should be before |max|. - let prev = tz.getPreviousTransition(max); - if (prev) { - assert(prev.epochNanoseconds < max.epochNanoseconds); - } - - // There shouldn't be any previous transition before |min|. - prev = tz.getPreviousTransition(min); - assert.sameValue(prev, null); -} diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/nextTransition/subtract-second-and-nanosecond-from-last-transition.js b/test/intl402/Temporal/ZonedDateTime/prototype/nextTransition/subtract-second-and-nanosecond-from-last-transition.js new file mode 100644 index 00000000000..4666f6238bc --- /dev/null +++ b/test/intl402/Temporal/ZonedDateTime/prototype/nextTransition/subtract-second-and-nanosecond-from-last-transition.js @@ -0,0 +1,41 @@ +// Copyright (C) 2022 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.nexttransition +description: > + Compute next transition when seconds resp. nanoseconds are subtracted from the last transition. +features: [Temporal] +---*/ + +// From : +// +// # Zone NAME STDOFF RULES FORMAT [UNTIL] +// Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15 0:01 +// 0:09:21 - PMT 1911 Mar 11 0:01 # Paris MT + +const zdt = new Temporal.PlainDateTime(1800, 1, 1).toZonedDateTime("Europe/Paris"); +assert.sameValue(zdt.toString(), "1800-01-01T00:00:00+00:09[Europe/Paris]"); +assert.sameValue(zdt.offsetNanoseconds, (9 * 60 + 21) * 1_000_000_000); + +// Ensure the first transition was correctly computed. +const first = zdt.nextTransition(); +assert.sameValue(first.toString(), "1911-03-10T23:50:39+00:00[Europe/Paris]"); + +let next; + +// Compute the next transition starting from the first transition minus 1s. +const firstMinus1s = first.add({seconds: -1}); +assert.sameValue(firstMinus1s.toString(), "1911-03-10T23:59:59+00:09[Europe/Paris]"); +assert.sameValue(firstMinus1s.offsetNanoseconds, (9 * 60 + 21) * 1_000_000_000); + +next = firstMinus1s.nextTransition(); +assert.sameValue(next.toString(), "1911-03-10T23:50:39+00:00[Europe/Paris]"); + +// Compute the next transition starting from the first transition minus 1ns. +const firstMinus1ns = first.add({nanoseconds: -1}); +assert.sameValue(firstMinus1ns.toString(), "1911-03-10T23:59:59.999999999+00:09[Europe/Paris]"); +assert.sameValue(firstMinus1ns.offsetNanoseconds, (9 * 60 + 21) * 1_000_000_000); + +next = firstMinus1ns.nextTransition(); +assert.sameValue(next.toString(), "1911-03-10T23:50:39+00:00[Europe/Paris]"); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/nextTransition/transition-at-instant-boundaries.js b/test/intl402/Temporal/ZonedDateTime/prototype/nextTransition/transition-at-instant-boundaries.js new file mode 100644 index 00000000000..5c6d29e6f0f --- /dev/null +++ b/test/intl402/Temporal/ZonedDateTime/prototype/nextTransition/transition-at-instant-boundaries.js @@ -0,0 +1,22 @@ +// Copyright (C) 2022 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.nexttransition +description: > + Test transitions at the instant boundaries. +features: [Temporal, Intl-enumeration] +---*/ + +for (let id of Intl.supportedValuesOf("timeZone")) { + const min = new Temporal.ZonedDateTime(-86_40000_00000_00000_00000n, id); + const max = new Temporal.ZonedDateTime(86_40000_00000_00000_00000n, id); + + const next = min.nextTransition(); + if (next) { + assert(next.epochNanoseconds > min.epochNanoseconds, + "If there's any next transition, it should be after |min|"); + } + + assert.sameValue(max.nextTransition(), null, "There shouldn't be any next transition after |max|"); +} diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/previousTransition/nanoseconds-subtracted-or-added-at-dst-transition.js b/test/intl402/Temporal/ZonedDateTime/prototype/previousTransition/nanoseconds-subtracted-or-added-at-dst-transition.js new file mode 100644 index 00000000000..59e085823f2 --- /dev/null +++ b/test/intl402/Temporal/ZonedDateTime/prototype/previousTransition/nanoseconds-subtracted-or-added-at-dst-transition.js @@ -0,0 +1,23 @@ +// Copyright (C) 2022 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.previoustransition +description: > + Test previous transition when nanoseconds are subtracted resp. added to the DST transition. +features: [Temporal] +---*/ + +const dt = Temporal.ZonedDateTime.from("2021-03-28T01:00:00Z[Europe/Berlin]"); + +assert.sameValue(dt.add({nanoseconds: -1}).previousTransition().toString(), + "2020-10-25T02:00:00+01:00[Europe/Berlin]", + "DST transition minus one nanosecond"); + +assert.sameValue(dt.previousTransition().toString(), + "2020-10-25T02:00:00+01:00[Europe/Berlin]", + "DST transition"); + +assert.sameValue(dt.add({nanoseconds: +1}).previousTransition().toString(), + "2021-03-28T03:00:00+02:00[Europe/Berlin]", + "DST transition plus one nanosecond"); diff --git a/test/intl402/Temporal/ZonedDateTime/prototype/previousTransition/transition-at-instant-boundaries.js b/test/intl402/Temporal/ZonedDateTime/prototype/previousTransition/transition-at-instant-boundaries.js new file mode 100644 index 00000000000..117534ebb6f --- /dev/null +++ b/test/intl402/Temporal/ZonedDateTime/prototype/previousTransition/transition-at-instant-boundaries.js @@ -0,0 +1,23 @@ +// Copyright (C) 2022 André Bargull. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +esid: sec-temporal.zoneddatetime.prototype.previoustransition +description: > + Test transitions at the instant boundaries. +features: [Temporal, Intl-enumeration] +---*/ + +for (let id of Intl.supportedValuesOf("timeZone")) { + const min = new Temporal.ZonedDateTime(-86_40000_00000_00000_00000n, id); + const max = new Temporal.ZonedDateTime(86_40000_00000_00000_00000n, id); + + const prev = max.previousTransition(); + if (prev) { + assert(prev.epochNanoseconds < max.epochNanoseconds, + "If there's any previous transition, it should be before |max|"); + } + + assert.sameValue(min.previousTransition(), null, + "There shouldn't be any previous transition before |min|"); +}