Skip to content

Commit

Permalink
Deploying to gh-pages from @ c3adf35 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomato committed Jan 15, 2025
1 parent bd4be9c commit da136ec
Show file tree
Hide file tree
Showing 15 changed files with 154 additions and 108 deletions.
2 changes: 1 addition & 1 deletion docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ <h2 id="object-relationship"><a class="heading-link" href="#object-relationship"

<h2 id="string-persistence-parsing-and-formatting"><a class="heading-link" href="#string-persistence-parsing-and-formatting"></a>String persistence, parsing, and formatting</h3><p>All <code>Temporal</code> types have a string representation for persistence and interoperability.
The correspondence between types and machine-readable strings is shown below.
For more information about string parsing, serialization, and formatting in <code>Temporal</code> (including how Temporal is using industry standards like ISO 8601 and RFC 3339), see <a href="./strings.html">String Parsing, Serialization, and Formatting</a>.</p>
For more information about string parsing, serialization, and formatting in <code>Temporal</code> (including how Temporal is using industry standards like ISO 8601, RFC 3339, and RFC 9557), see <a href="./strings.html">String Parsing, Serialization, and Formatting</a>.</p>
<img src="persistence-model.svg">

<h2 id="other-documentation"><a class="heading-link" href="#other-documentation"></a>Other documentation</h3><ul>
Expand Down
62 changes: 39 additions & 23 deletions docs/cookbook.html

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/duration.html
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,6 @@ <h3 id="subtract"><a class="heading-link" href="#subtract"></a>duration.<strong>
<p>The <code>locales</code> and <code>options</code> arguments are the same as in the constructor to <a href="http://tc39.es/proposal-intl-duration-format/"><code>Intl.DurationFormat</code></a>.</p>
<blockquote>
<p><strong>NOTE</strong>: This method requires that your JavaScript environment supports <code>Intl.DurationFormat</code>.
That is still an early-stage proposal and at the time of writing it is not supported anywhere.
If <code>Intl.DurationFormat</code> is not available, then the output of this method is the same as that of <code>duration.toString()</code>, and the <code>locales</code> and <code>options</code> arguments are ignored.</p>
</blockquote>
<p>Usage examples:</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ <h2 id="object-relationship"><a class="heading-link" href="#object-relationship"

<h2 id="string-persistence-parsing-and-formatting"><a class="heading-link" href="#string-persistence-parsing-and-formatting"></a>String persistence, parsing, and formatting</h3><p>All <code>Temporal</code> types have a string representation for persistence and interoperability.
The correspondence between types and machine-readable strings is shown below.
For more information about string parsing, serialization, and formatting in <code>Temporal</code> (including how Temporal is using industry standards like ISO 8601 and RFC 3339), see <a href="./strings.html">String Parsing, Serialization, and Formatting</a>.</p>
For more information about string parsing, serialization, and formatting in <code>Temporal</code> (including how Temporal is using industry standards like ISO 8601, RFC 3339, and RFC 9557), see <a href="./strings.html">String Parsing, Serialization, and Formatting</a>.</p>
<img src="persistence-model.svg">

<h2 id="other-documentation"><a class="heading-link" href="#other-documentation"></a>Other documentation</h3><ul>
Expand Down
12 changes: 8 additions & 4 deletions docs/plaindate.html
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,14 @@ <h2 id="constructor"><a class="heading-link" href="#constructor"></a>Constructor
<li>Must have either a number <code>month</code> property or a string <code>monthCode</code> property.</li>
<li>May have a <code>calendar</code> property. If omitted, the <a href="https://en.wikipedia.org/wiki/ISO_8601#Dates">ISO 8601 calendar</a> will be used by default.</li>
</ul>
<p>If the value is not an object, it must be a string, which is expected to be in ISO 8601 format.
<p>If the value is not an object, it must be a string, which is expected to be in RFC 9557 format, or a subset of that format that includes at least the date portion.
Any time part is optional and will be ignored.
Time zone or UTC offset information will also be ignored, with one exception: if a string contains a <code>Z</code> in place of a numeric UTC offset, then a <code>RangeError</code> will be thrown because interpreting these strings as a local date and time is usually a bug. <code>Temporal.Instant.from</code> should be used instead to parse these strings, and the result&#39;s <code>toZonedDateTimeISO</code> method can be used to obtain a timezone-local date and time.</p>
<p>Note that ISO 8601 and RFC 3339 formats are also subsets of RFC 9557, so will also work.
Temporal additionally accepts a few ISO 8601 extensions that RFC 9557 does not, like the use of 6-digit years.
For more info, see <a href="https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar">RFC 9557 / ISO 8601 Grammar</a>.</p>
<p>In unusual cases of needing date or time components of <code>Z</code>-terminated timestamp strings (e.g. daily rollover of a UTC-timestamped log file), use the time zone <code>&#39;UTC&#39;</code>. For example, the following code returns a &quot;UTC date&quot;: <code>Temporal.Instant.from(item).toZonedDateTimeISO(&#39;UTC&#39;).toPlainDate()</code>.</p>
<p>If the string isn&#39;t valid according to ISO 8601, then a <code>RangeError</code> will be thrown regardless of the value of <code>overflow</code>.</p>
<p>If the string isn&#39;t a valid subset of the RFC 9557 format, then a <code>RangeError</code> will be thrown regardless of the value of <code>overflow</code>.</p>
<p>The <code>overflow</code> option works as follows, if <code>item</code> is an object:</p>
<ul>
<li>In <code>&#39;constrain&#39;</code> mode (the default), any out-of-range values are clamped to the nearest in-range value (after assuming extension of eras over arbitrary years to substitute <code>era</code> and <code>eraYear</code> with appropriate values for the <code>item</code>).</li>
Expand Down Expand Up @@ -657,11 +660,12 @@ <h3 id="since"><a class="heading-link" href="#since"></a>date.<strong>since</str
</ul>
</li>
</ul>
<p><strong>Returns:</strong> a string in the ISO 8601 date format representing <code>date</code>.</p>
<p><strong>Returns:</strong> a string in the RFC 9557 date format representing <code>date</code>.</p>
<p>This method overrides the <code>Object.prototype.toString()</code> method and provides a convenient, unambiguous string representation of <code>date</code>.
The string can be passed to <code>Temporal.PlainDate.from()</code> to create a new <code>Temporal.PlainDate</code> object.</p>
<p>Normally, a calendar annotation is shown when <code>date</code>&#39;s calendar is not the ISO 8601 calendar.
By setting the <code>calendarName</code> option to <code>&#39;always&#39;</code> or <code>&#39;never&#39;</code> this can be overridden to always or never show the annotation, respectively.
With <code>calendarName: &#39;never&#39;</code> the returned string will additionally be valid in the ISO 8601 and RFC 3339 date formats.
Normally not necessary, a value of <code>&#39;critical&#39;</code> is equivalent to <code>&#39;always&#39;</code> but the annotation will contain an additional <code>!</code> for certain interoperation use cases.
For more information on the calendar annotation, see <a href="./strings.html#calendar-systems">the <code>Temporal</code> string formats documentation</a>.</p>
<p>Example usage:</p>
Expand All @@ -679,7 +683,7 @@ <h3 id="since"><a class="heading-link" href="#since"></a>date.<strong>since</str
date<span class="token punctuation">.</span><span class="token function">toLocaleString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// example output: 8/24/2006</span>
date<span class="token punctuation">.</span><span class="token function">toLocaleString</span><span class="token punctuation">(</span><span class="token string">'de-DE'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// example output: '24.8.2006'</span>
date<span class="token punctuation">.</span><span class="token function">toLocaleString</span><span class="token punctuation">(</span><span class="token string">'de-DE'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token literal-property property">weekday</span><span class="token operator">:</span> <span class="token string">'long'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// => 'Donnerstag'</span>
date<span class="token punctuation">.</span><span class="token function">toLocaleString</span><span class="token punctuation">(</span><span class="token string">'en-US-u-nu-fullwide'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// => '8/24/2006'</span></code></pre><h3 id="toJSON"><a class="heading-link" href="#toJSON"></a>date.<strong>toJSON</strong>() : string</h3><p><strong>Returns:</strong> a string in the ISO 8601 date format representing <code>date</code>.</p>
date<span class="token punctuation">.</span><span class="token function">toLocaleString</span><span class="token punctuation">(</span><span class="token string">'en-US-u-nu-fullwide'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// => '8/24/2006'</span></code></pre><h3 id="toJSON"><a class="heading-link" href="#toJSON"></a>date.<strong>toJSON</strong>() : string</h3><p><strong>Returns:</strong> a string in the RFC 9557 date format representing <code>date</code>.</p>
<p>This method is the same as <code>date.toString()</code>.
It is usually not called directly, but it can be called automatically by <code>JSON.stringify()</code>.</p>
<p>The reverse operation, recovering a <code>Temporal.PlainDate</code> object from a string, is <code>Temporal.PlainDate.from()</code>, but it cannot be called automatically by <code>JSON.parse()</code>.
Expand Down
14 changes: 9 additions & 5 deletions docs/plaindatetime.html
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,13 @@ <h2 id="constructor"><a class="heading-link" href="#constructor"></a>Constructor
Default values for other missing fields are determined by the calendar.</p>
<p>If the <code>calendar</code> property is not present, it&#39;s assumed to be <code>&#39;iso8601&#39;</code> (identifying the <a href="https://en.wikipedia.org/wiki/ISO_8601#Dates">ISO 8601 calendar</a>).
Any other missing properties will be assumed to be 0 (for time fields).</p>
<p>If the value is not an object, it must be a string, which is expected to be in ISO 8601 format.
<p>If the value is not an object, it must be a string, which is expected to be in RFC 9557 format, or a subset of that format that includes at least the date portion.
Time zone or UTC offset information will be ignored, with one exception: if a string contains a <code>Z</code> in place of a numeric UTC offset, then a <code>RangeError</code> will be thrown because interpreting these strings as a local date and time is usually a bug. <code>Temporal.Instant.from</code> should be used instead to parse these strings, and the result&#39;s <code>toZonedDateTimeISO</code> method can be used to obtain a timezone-local date and time.</p>
<p>Note that ISO 8601 and RFC 3339 formats are also subsets of RFC 9557, so will also work.
Temporal additionally accepts a few ISO 8601 extensions that RFC 9557 does not, like the use of 6-digit years.
For more info, see <a href="https://tc39.es/proposal-temporal/#sec-temporal-iso8601grammar">RFC 9557 / ISO 8601 Grammar</a>.</p>
<p>In unusual cases of needing date or time components of <code>Z</code>-terminated timestamp strings (e.g. daily rollover of a UTC-timestamped log file), use the time zone <code>&#39;UTC&#39;</code>. For example, the following code returns a &quot;UTC date&quot;: <code>Temporal.Instant.from(item).toZonedDateTimeISO(&#39;UTC&#39;).toPlainDate()</code>.</p>
<p>If the string isn&#39;t valid according to ISO 8601, then a <code>RangeError</code> will be thrown regardless of the value of <code>overflow</code>.</p>
<p>If the string isn&#39;t a valid subset of the RFC 9557 format, then a <code>RangeError</code> will be thrown regardless of the value of <code>overflow</code>.</p>
<p>The <code>overflow</code> option works as follows, if <code>item</code> is an object:</p>
<ul>
<li>In <code>&#39;constrain&#39;</code> mode (the default), any out-of-range values are clamped to the nearest in-range value (after assuming extension of eras over arbitrary years to substitute <code>era</code> and <code>eraYear</code> with appropriate values for the <code>item</code>).</li>
Expand All @@ -332,7 +335,7 @@ <h2 id="constructor"><a class="heading-link" href="#constructor"></a>Constructor
<p>Additionally, if the result is earlier or later than the range of dates that <code>Temporal.PlainDateTime</code> can represent (approximately half a million years centered on the <a href="https://en.wikipedia.org/wiki/Unix_time">Unix epoch</a>), then this method will throw a <code>RangeError</code> regardless of <code>overflow</code>.</p>
<blockquote>
<p><strong>NOTE</strong>: Although Temporal does not deal with leap seconds, dates coming from other software may have a <code>second</code> value of 60.
In the default <code>&#39;constrain&#39;</code> mode and when parsing an ISO 8601 string, this will be converted to 59.
In the default <code>&#39;constrain&#39;</code> mode and when parsing an RFC 9557 string, this will be converted to 59.
In <code>&#39;reject&#39;</code> mode, this function will throw, so if you have to interoperate with times that may contain leap seconds, don&#39;t use <code>&#39;reject&#39;</code>.</p>
</blockquote>
<blockquote>
Expand Down Expand Up @@ -832,7 +835,7 @@ <h3 id="equals"><a class="heading-link" href="#equals"></a>datetime.<strong>equa
</ul>
</li>
</ul>
<p><strong>Returns:</strong> a string in the ISO 8601 date format representing <code>datetime</code>.</p>
<p><strong>Returns:</strong> a string in the RFC 9557 date format representing <code>datetime</code>.</p>
<p>This method overrides the <code>Object.prototype.toString()</code> method and provides a convenient, unambiguous string representation of <code>datetime</code>.
The string can be passed to <code>Temporal.PlainDateTime.from()</code> to create a new <code>Temporal.PlainDateTime</code> object.</p>
<p>The output precision can be controlled with the <code>fractionalSecondDigits</code> or <code>smallestUnit</code> option.
Expand All @@ -841,6 +844,7 @@ <h3 id="equals"><a class="heading-link" href="#equals"></a>datetime.<strong>equa
Note that rounding may change the value of other units as well.</p>
<p>Normally, a calendar annotation is shown when <code>datetime</code>&#39;s calendar is not the ISO 8601 calendar.
By setting the <code>calendarName</code> option to <code>&#39;always&#39;</code> or <code>&#39;never&#39;</code> this can be overridden to always or never show the annotation, respectively.
With <code>calendarName: &#39;never&#39;</code> the output string will additionally be valid in the ISO 8601 and RFC 3339 date formats.
Normally not necessary, a value of <code>&#39;critical&#39;</code> is equivalent to <code>&#39;always&#39;</code> but the annotation will contain an additional <code>!</code> for certain interoperation use cases.
For more information on the calendar annotation, see <a href="./strings.html#calendar-systems">the <code>Temporal</code> string formats documentation</a>.</p>
<p>Example usage:</p>
Expand Down Expand Up @@ -882,7 +886,7 @@ <h3 id="toLocaleString"><a class="heading-link" href="#toLocaleString"></a>datet
dt<span class="token punctuation">.</span><span class="token function">toLocaleString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// example output: 1995-12-07, 3:24:30 a.m.</span>
dt<span class="token punctuation">.</span><span class="token function">toLocaleString</span><span class="token punctuation">(</span><span class="token string">'de-DE'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// example output: 7.12.1995, 03:24:30</span>
dt<span class="token punctuation">.</span><span class="token function">toLocaleString</span><span class="token punctuation">(</span><span class="token string">'de-DE'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token literal-property property">timeZone</span><span class="token operator">:</span> <span class="token string">'Europe/Berlin'</span><span class="token punctuation">,</span> <span class="token literal-property property">weekday</span><span class="token operator">:</span> <span class="token string">'long'</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// => 'Donnerstag'</span>
dt<span class="token punctuation">.</span><span class="token function">toLocaleString</span><span class="token punctuation">(</span><span class="token string">'en-US-u-nu-fullwide-hc-h12'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// => '12/7/1995, 3:24:30 AM'</span></code></pre><h3 id="toJSON"><a class="heading-link" href="#toJSON"></a>datetime.<strong>toJSON</strong>() : string</h3><p><strong>Returns:</strong> a string in the ISO 8601 date format representing <code>datetime</code>.</p>
dt<span class="token punctuation">.</span><span class="token function">toLocaleString</span><span class="token punctuation">(</span><span class="token string">'en-US-u-nu-fullwide-hc-h12'</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// => '12/7/1995, 3:24:30 AM'</span></code></pre><h3 id="toJSON"><a class="heading-link" href="#toJSON"></a>datetime.<strong>toJSON</strong>() : string</h3><p><strong>Returns:</strong> a string in the RFC 9557 date format representing <code>datetime</code>.</p>
<p>This method is the same as <code>datetime.toString()</code>.
It is usually not called directly, but it can be called automatically by <code>JSON.stringify()</code>.</p>
<p>The reverse operation, recovering a <code>Temporal.PlainDateTime</code> object from a string, is <code>Temporal.PlainDateTime.from()</code>, but it cannot be called automatically by <code>JSON.parse()</code>.
Expand Down
Loading

0 comments on commit da136ec

Please sign in to comment.