Skip to content

Commit

Permalink
Normative: Add Temporal[@@toStringTag].
Browse files Browse the repository at this point in the history
Fixes #1539.

Co-authored-by: Jordan Harband <ljharb@gmail.com>
  • Loading branch information
Ms2ger and ljharb committed Jul 27, 2021
1 parent 828dd2f commit f60d69c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions polyfill/lib/shim.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Object.defineProperty(globalThis, 'Temporal', {
configurable: true
});
copy(globalThis.Temporal, Temporal);
Object.defineProperty(globalThis.Temporal, Symbol.toStringTag, {
value: 'Temporal',
writable: false,
enumerable: false,
configurable: true
});
copy(globalThis.Temporal.Now, Temporal.Now);
copy(globalThis.Intl, Intl);
Object.defineProperty(globalThis.Date.prototype, 'toTemporalInstant', {
Expand Down
15 changes: 15 additions & 0 deletions polyfill/test/Temporal/toStringTag/prop-desc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// 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-@@tostringtag
includes: [propertyHelper.js]
features: [Symbol.toStringTag, Temporal]
---*/

verifyProperty(Temporal, Symbol.toStringTag, {
value: "Temporal",
writable: false,
enumerable: false,
configurable: true,
});
9 changes: 9 additions & 0 deletions polyfill/test/Temporal/toStringTag/string.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// 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-@@tostringtag
features: [Symbol.toStringTag, Temporal]
---*/

assert.sameValue(String(Temporal), "[object Temporal]");
9 changes: 9 additions & 0 deletions spec/temporal.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ <h1>The Temporal Object</h1>
<li>does not have a [[Call]] internal method; it cannot be invoked as a function.</li>
</ul>

<emu-clause id="sec-value-properties-of-the-temporal-object">
<h1>Value Properties of the Temporal Object</h1>
<emu-clause id="sec-temporal-@@tostringtag">
<h1>Temporal [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the String value *"Temporal"*.</p>
<p>This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</p>
</emu-clause>
</emu-clause>

<emu-clause id="sec-constructor-properties-of-the-temporal-object">
<h1>Constructor Properties of the Temporal Object</h1>
<emu-clause id="sec-temporal-instant">
Expand Down

0 comments on commit f60d69c

Please sign in to comment.