Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal proposal HTML serialization support #6284

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 192 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3119,6 +3119,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li>The <dfn data-x="js-HostSystemUTCEpochNanoseconds" data-x-href="https://tc39.es/proposal-temporal/#sec-hostsystemutcepochnanoseconds">HostSystemUTCEpochNanoseconds</dfn> abstract operation</li>
<li>The <dfn data-x-href="https://tc39.es/proposal-temporal/#eqn-nsMaxInstant">nsMaxInstant</dfn> and
<dfn data-x-href="https://tc39.es/proposal-temporal/#eqn-nsMinInstant">nsMinInstant</dfn> values</li>
<li>The <dfn data-x-href="https://tc39.es/proposal-temporal/#sec-temporal.plaindate">%Temporal.PlainDate%</dfn> constructor</li>
<li>The <dfn data-x-href="https://tc39.es/proposal-temporal/#sec-temporal.plaintime">%Temporal.PlainTime%</dfn> constructor</li>
<li>The <dfn data-x-href="https://tc39.es/proposal-temporal/#sec-temporal.plaindatetime">%Temporal.PlainDateTime%</dfn> constructor</li>
<li>The <dfn data-x-href="https://tc39.es/proposal-temporal/#sec-temporal.zoneddatetime">%Temporal.ZonedDateTime%</dfn> constructor</li>
<li>The <dfn data-x-href="https://tc39.es/proposal-temporal/#sec-temporal.duration">%Temporal.Duration%</dfn> constructor</li>
<li>The <dfn data-x-href="https://tc39.es/proposal-temporal/#sec-temporal.instant">%Temporal.Instant%</dfn> constructor</li>
<li>The <dfn data-x-href="https://tc39.es/proposal-temporal/#sec-temporal.plainyearmonth">%Temporal.PlainYearMonth%</dfn> constructor</li>
<li>The <dfn data-x-href="https://tc39.es/proposal-temporal/#sec-temporal.plainmonthday">%Temporal.PlainMonthDay%</dfn> constructor</li>
</ul>
</dd>

Expand Down Expand Up @@ -9735,6 +9743,101 @@ interface <dfn interface>DOMStringList</dfn> {
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> has an [[InitializedTemporalDate]] internal slot, then:</p>

<ol>
<li><p>Set <var>serialized</var> to { [[Type]]: "Temporal.PlainDate", [[ISOYear]]:
<var>value</var>.[[ISOYear]], [[ISOMonth]]: <var>value</var>.[[ISOMonth]], [[ISODay]]:
<var>value</var>.[[ISODay]], [[Calendar]]: <var>value</var>.[[Calendar]] }.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> has an [[InitializedTemporalTime]] internal slot, then:</p>

<ol>
<li><p>Set <var>serialized</var> to { [[Type]]: "Temporal.PlainTime", [[ISOHour]]:
<var>value</var>.[[ISOHour]], [[ISOMinute]]: <var>value</var>.[[ISOMinute]], [[ISOSecond]]:
<var>value</var>.[[ISOSecond]], [[ISOMillisecond]]: <var>value</var>.[[ISOMillisecond]],
[[ISOMicrosecond]]: <var>value</var>.[[ISOMicrosecond]], [[ISONanosecond]]:
<var>value</var>.[[ISONanosecond]] }.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> has an [[InitializedTemporalDateTime]] internal slot,
then:</p>

<ol>
<li><p>Set <var>serialized</var> to { [[Type]]: "Temporal.PlainDateTime", [[ISOYear]]:
<var>value</var>.[[ISOYear]], [[ISOMonth]]: <var>value</var>.[[ISOMonth]], [[ISODay]]:
<var>value</var>.[[ISODay]], [[ISOHour]]: <var>value</var>.[[ISOHour]], [[ISOMinute]]:
<var>value</var>.[[ISOMinute]], [[ISOSecond]]: <var>value</var>.[[ISOSecond]],
[[ISOMillisecond]]: <var>value</var>.[[ISOMillisecond]], [[ISOMicrosecond]]:
<var>value</var>.[[ISOMicrosecond]], [[ISONanosecond]]: <var>value</var>.[[ISONanosecond]],
[[Calendar]]: <var>value</var>.[[Calendar]] }.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> has an [[InitializedTemporalZonedDateTime]] internal slot,
then:</p>

<ol>
<li><p>Set <var>serialized</var> to { [[Type]]: "Temporal.ZonedDateTime", [[Nanoseconds]]:
<var>value</var>.[[Nanoseconds]], [[TimeZone]]: <var>value</var>.[[TimeZone]], [[Calendar]]:
<var>value</var>.[[Calendar]] }.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> has an [[InitializedTemporalDuration]] internal slot,
then:</p>

<ol>
<li><p>Set <var>serialized</var> to { [[Type]]: "Temporal.Duration", [[Years]]:
<var>value</var>.[[Years]], [[Months]]: <var>value</var>.[[Months]], [[Weeks]]:
<var>value</var>.[[Weeks]], [[Days]]: <var>value</var>.[[Days]], [[Hours]]:
<var>value</var>.[[Hours]], [[Minutes]]: <var>value</var>.[[Minutes]], [[Seconds]]:
<var>value</var>.[[Seconds]], [[Milliseconds]]: <var>value</var>.[[Milliseconds]],
[[Microseconds]]: <var>value</var>.[[Microseconds]], [[Nanoseconds]]:
<var>value</var>.[[Nanoseconds]] }.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> has an [[InitializedTemporalInstant]] internal slot,
then:</p>

<ol>
<li><p>Set <var>serialized</var> to { [[Type]]: "Temporal.Instant", [[Nanoseconds]]:
<var>value</var>.[[Nanoseconds]] }.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> has an [[InitializedTemporalYearMonth]] internal slot,
then:</p>

<ol>
<li><p>Set <var>serialized</var> to { [[Type]]: "Temporal.PlainYearMonth", [[ISOYear]]:
<var>value</var>.[[ISOYear]], [[ISOMonth]]: <var>value</var>.[[ISOMonth]], [[ISODay]]:
<var>value</var>.[[ISODay]], [[Calendar]]: <var>value</var>.[[Calendar]] }.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> has an [[InitializedTemporalMonthDay]] internal slot,
then:</p>

<ol>
<li><p>Set <var>serialized</var> to { [[Type]]: "Temporal.PlainMonthDay", [[ISOYear]]:
<var>value</var>.[[ISOYear]], [[ISOMonth]]: <var>value</var>.[[ISOMonth]], [[ISODay]]:
<var>value</var>.[[ISODay]], [[Calendar]]: <var>value</var>.[[Calendar]] }.</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>value</var> is a <span>platform object</span> that is a <span
data-x="serializable objects">serializable object</span>:</p>
Expand Down Expand Up @@ -10175,6 +10278,95 @@ o.myself = o;</code></pre>
</ol>
</li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "Temporal.PlainDate", then:</p>

<ol>
<li><p>Set <var>value</var> to ! <span>Construct</span>(<span>%Temporal.PlainDate%</span>,
&laquo; <var>serialized</var>.[[ISOYear]], <var>serialized</var>.[[ISOMonth]],
<var>serialized</var>.[[ISODay]], <var>serialized</var>.[[Calendar]] &raquo;).</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "Temporal.PlainTime", then:</p>

<ol>
<li><p>Set <var>value</var> to ! <span>Construct</span>(<span>%Temporal.PlainTime%</span>,
&laquo; <var>serialized</var>.[[ISOHour]], <var>serialized</var>.[[ISOMinute]],
<var>serialized</var>.[[ISOSecond]], <var>serialized</var>.[[ISOMillisecond]],
<var>serialized</var>.[[ISOMicrosecond]], <var>serialized</var>.[[ISONanosecond]]
&raquo;).</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "Temporal.PlainDateTime", then:</p>

<ol>
<li><p>Set <var>value</var> to ! <span>Construct</span>(<span>%Temporal.PlainDateTime%</span>,
&laquo; <var>serialized</var>.[[ISOYear]], <var>serialized</var>.[[ISOMonth]],
<var>serialized</var>.[[ISODay]], <var>serialized</var>.[[ISOHour]],
<var>serialized</var>.[[ISOMinute]], <var>serialized</var>.[[ISOSecond]],
<var>serialized</var>.[[ISOMillisecond]], <var>serialized</var>.[[ISOMicrosecond]],
<var>serialized</var>.[[ISONanosecond]], <var>serialized</var>.[[Calendar]] &raquo;).</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "Temporal.ZonedDateTime", then:</p>

<ol>
<li><p>Set <var>value</var> to ! <span>Construct</span>(<span>%Temporal.ZonedDateTime%</span>,
&laquo; <var>serialized</var>.[[Nanoseconds]], <var>serialized</var>.[[TimeZone]],
<var>serialized</var>.[[Calendar]] &raquo;).</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "Temporal.Duration", then:</p>

<ol>
<li><p>Set <var>value</var> to ! <span>Construct</span>(<span>%Temporal.Duration%</span>,
&laquo; <var>serialized</var>.[[Years]], <var>serialized</var>.[[Months]],
<var>serialized</var>.[[Weeks]], <var>serialized</var>.[[Days]],
<var>serialized</var>.[[Hours]], <var>serialized</var>.[[Minutes]],
<var>serialized</var>.[[Seconds]], <var>serialized</var>.[[Milliseconds]],
<var>serialized</var>.[[Microseconds]], <var>serialized</var>.[[Nanoseconds]]
&raquo;).</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "Temporal.Instant", then:</p>

<ol>
<li><p>Set <var>value</var> to ! <span>Construct</span>(<span>%Temporal.Instant%</span>,
&laquo; <var>serialized</var>.[[Nanoseconds]] &raquo;).</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "Temporal.PlainYearMonth", then:</p>

<ol>
<li><p>Set <var>value</var> to !
<span>Construct</span>(<span>%Temporal.PlainYearMonth%</span>, &laquo;
<var>serialized</var>.[[ISOYear]], <var>serialized</var>.[[ISOMonth]],
<var>serialized</var>.[[Calendar]], <var>serialized</var>.[[ISODay]] &raquo;).</p></li>
</ol>
</li>

<li>
<p>Otherwise, if <var>serialized</var>.[[Type]] is "Temporal.PlainMonthDay", then:</p>

<ol>
<li><p>Set <var>value</var> to ! <span>Construct</span>(<span>%Temporal.PlainMonthDay%</span>,
&laquo; <var>serialized</var>.[[ISOMonth]], <var>serialized</var>.[[ISODay]],
<var>serialized</var>.[[Calendar]], <var>serialized</var>.[[ISOYear]] &raquo;).</p></li>
</ol>
</li>

<li>
<p>Otherwise:</p>

Expand Down
Loading