Skip to content

Commit

Permalink
Use Intl.DurationFormat in Temporal.Duration.prototype.toLocaleString
Browse files Browse the repository at this point in the history
This operation had a placeholder note until the Intl.DurationFormat
proposal would reach stage 4. Now that the proposal is stage 4, we can
replace the placeholder note with the real implementation.

Closes: #452
  • Loading branch information
ptomato committed Feb 13, 2025
1 parent 0cb16e1 commit d1a87a4
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions spec/intl.html
Original file line number Diff line number Diff line change
Expand Up @@ -1721,12 +1721,18 @@ <h1>Properties of the Temporal.Duration Prototype Object</h1>

<emu-clause id="sup-temporal.duration.prototype.tolocalestring">
<h1>Temporal.Duration.prototype.toLocaleString ( [ _locales_ [ , _options_ ] ] )</h1>
<emu-note type="editor">
<p>
This function is currently not specified.
See <a href="https://tc39.es/proposal-intl-duration-format/">the Intl.DurationFormat proposal</a>.
</p>
</emu-note>
<p>This definition supersedes the definition provided in <emu-xref href="#sec-temporal.duration.prototype.tolocalestring"></emu-xref>.</p>
<p>This method performs the following steps when called:</p>
<emu-alg>
1. Let _duration_ be the *this* value.
1. Perform ? RequireInternalSlot(_duration_, [[InitializedTemporalDuration]]).
1. Let _formatter_ be ? Construct(%Intl.DurationFormat%, « _locales_, _options_ »).
1. Let _parts_ be PartitionDurationFormatPattern(_formatter_, _duration_).
1. Let _result_ be the empty String.
1. For each Record _part_ in _parts_, do
1. Set _result_ to the string-concatenation of _result_ and _part_.[[Value]].
1. Return _result_.
</emu-alg>
</emu-clause>
</emu-clause>

Expand Down

0 comments on commit d1a87a4

Please sign in to comment.