Skip to content

Commit

Permalink
Normative: Add Temporal.Now[@@toStringTag]
Browse files Browse the repository at this point in the history
As per the July 2021 TC39 meeting, this should have the value
"Temporal.Now".
  • Loading branch information
ptomato authored and Ms2ger committed Jul 27, 2021
1 parent f60d69c commit c740827
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
6 changes: 6 additions & 0 deletions polyfill/lib/now.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,9 @@ export const Now = {
zonedDateTime,
zonedDateTimeISO
};
Object.defineProperty(Now, Symbol.toStringTag, {
value: 'Temporal.Now',
writable: false,
enumerable: false,
configurable: true
});
15 changes: 15 additions & 0 deletions polyfill/test/Now/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-now-@@tostringtag
includes: [propertyHelper.js]
features: [Symbol.toStringTag, Temporal]
---*/

verifyProperty(Temporal.Now, Symbol.toStringTag, {
value: "Temporal.Now",
writable: false,
enumerable: false,
configurable: true,
});
9 changes: 9 additions & 0 deletions polyfill/test/Now/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-now-@@tostringtag
features: [Symbol.toStringTag, Temporal]
---*/

assert.sameValue(String(Temporal.Now), "[object Temporal.Now]");
9 changes: 9 additions & 0 deletions spec/temporal.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ <h1>The Temporal.Now 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-now-object">
<h1>Value Properties of the Temporal.Now Object</h1>
<emu-clause id="sec-temporal-now-@@tostringtag">
<h1>Temporal.Now [ @@toStringTag ]</h1>
<p>The initial value of the @@toStringTag property is the String value *"Temporal.Now"*.</p>
<p>This property has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*, [[Configurable]]: *true* }.</p>
</emu-clause>
</emu-clause>

<emu-clause id="sec-function-properties-of-the-temporal-now-object">
<h1>Function Properties of the Temporal.Now Object</h1>

Expand Down

0 comments on commit c740827

Please sign in to comment.