Skip to content

Commit

Permalink
Deploying to gh-pages from @ b5856d6 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
ptomato committed Oct 30, 2024
1 parent e1fbbab commit ae51b85
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/cookbook.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ <h2 id="converting-between-temporal-types-and-legacy-date"><a class="heading-lin

<span class="token comment">// To use the system's local time zone, which corresponds to using</span>
<span class="token comment">// legacy Date's getFullYear(), getMonth(), etc. methods, pass</span>
<span class="token comment">// Temporal.Now.timeZone() as the time zone. In a browser, this</span>
<span class="token comment">// Temporal.Now.timeZoneId() as the time zone. In a browser, this</span>
<span class="token comment">// will be the user's time zone, but on a server the value may not</span>
<span class="token comment">// be what you expect, so avoid doing this in a server context.</span>

Expand Down
4 changes: 2 additions & 2 deletions docs/instant.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,13 @@ <h2 id="interoperability-with-date"><a class="heading-link" href="#interoperabil
<!-- prettier-ignore-start -->
<pre class="language-javascript"><code class="language-javascript">date <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Date</span><span class="token punctuation">(</span><span class="token number">2019</span><span class="token punctuation">,</span> <span class="token number">11</span><span class="token punctuation">,</span> <span class="token number">31</span><span class="token punctuation">,</span> <span class="token number">18</span><span class="token punctuation">,</span> <span class="token number">30</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// => Tue Dec 31 2019 18:30:00 GMT-0800 (Pacific Standard Time)</span>
instant <span class="token operator">=</span> date<span class="token punctuation">.</span><span class="token function">toTemporalInstant</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// => 2020-01-01T02:30:00Z</span>
zonedDateTime <span class="token operator">=</span> instant<span class="token punctuation">.</span><span class="token function">toZonedDateTimeISO</span><span class="token punctuation">(</span>Temporal<span class="token punctuation">.</span>Now<span class="token punctuation">.</span><span class="token function">timeZone</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
zonedDateTime <span class="token operator">=</span> instant<span class="token punctuation">.</span><span class="token function">toZonedDateTimeISO</span><span class="token punctuation">(</span>Temporal<span class="token punctuation">.</span>Now<span class="token punctuation">.</span><span class="token function">timeZoneId</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// => 2019-12-31T18:30:00-08:00[America/Los_Angeles]</span>
zonedDateTime<span class="token punctuation">.</span>day<span class="token punctuation">;</span> <span class="token comment">// => 31</span>
dateOnly <span class="token operator">=</span> zonedDateTime<span class="token punctuation">.</span><span class="token function">toPlainDate</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> <span class="token comment">// => 2019-12-31</span></code></pre><!-- prettier-ignore-end -->

<p>Bugs in <code>Date</code>=&gt;<code>Temporal</code> conversions can be caused by picking the wrong time zone when converting from <code>Temporal.Instant</code> to <code>Temporal.ZonedDateTime</code>.
For example, the example above constructs the <code>Date</code> using local-timezone parameters, so it uses the system time zone: <code>Temporal.Now.timeZone()</code>.
For example, the example above constructs the <code>Date</code> using local-timezone parameters, so it uses the system time zone: <code>Temporal.Now.timeZoneId()</code>.
But if the <code>Date</code> had been initialized with a string like <code>&#39;2019-12-31&#39;</code>, then getting the same date back in a <code>Temporal.PlainDate</code> would require using the <code>&#39;UTC&#39;</code> time zone instead.</p>
<p>For discussion and code examples about picking the correct time zone, and also about <code>Date</code>&lt;=&gt;<code>Temporal</code> interoperability in general, see <a href="cookbook.html#converting-between-temporal-types-and-legacy-date">Converting between <code>Temporal</code> types and legacy <code>Date</code></a> in the documentation cookbook.</p>
<h2 id="constructor"><a class="heading-link" href="#constructor"></a>Constructor</h3><h3 id="new-Temporal-Instant"><a class="heading-link" href="#new-Temporal-Instant"></a><strong>new Temporal.Instant</strong>(<em>epochNanoseconds</em> : bigint) : Temporal.Instant</h3><p><strong>Parameters:</strong></p>
Expand Down
8 changes: 4 additions & 4 deletions docs/now.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ <h1 id="temporalnow"><a class="heading-link" href="#temporalnow"></a><code>Tempo
<blockquote>
<p><strong>NOTE</strong>: These methods allow for up to nanosecond accuracy, but browsers and other environments may limit the accuracy for security reasons.</p>
</blockquote>
<h2 id="methods"><a class="heading-link" href="#methods"></a>Methods</h3><h3 id="zonedDateTimeISO"><a class="heading-link" href="#zonedDateTimeISO"></a>Temporal.Now.<strong>zonedDateTimeISO</strong>(<em>timeZone</em>: object | string = Temporal.Now.timeZone()) : Temporal.ZonedDateTime</h3><p><strong>Parameters:</strong></p>
<h2 id="methods"><a class="heading-link" href="#methods"></a>Methods</h3><h3 id="zonedDateTimeISO"><a class="heading-link" href="#zonedDateTimeISO"></a>Temporal.Now.<strong>zonedDateTimeISO</strong>(<em>timeZone</em>: object | string = Temporal.Now.timeZoneId()) : Temporal.ZonedDateTime</h3><p><strong>Parameters:</strong></p>
<ul>
<li><code>timeZone</code> (optional string or <code>Temporal.ZonedDateTime</code>): The time zone to get the current date and time in, as a time zone identifier, or a <code>Temporal.ZonedDateTime</code> object whose time zone will be used.
If not given, the current system time zone will be used.</li>
Expand Down Expand Up @@ -219,7 +219,7 @@ <h2 id="methods"><a class="heading-link" href="#methods"></a>Methods</h3><h3 id=
after <span class="token operator">=</span> nextTransition<span class="token punctuation">.</span><span class="token function">add</span><span class="token punctuation">(</span><span class="token punctuation">{</span> <span class="token literal-property property">nanoseconds</span><span class="token operator">:</span> <span class="token number">1</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">.</span>offset<span class="token punctuation">;</span>
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">At </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>nextTransition<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string"> the offset will change from UTC </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>before<span class="token interpolation-punctuation punctuation">}</span></span><span class="token string"> to </span><span class="token interpolation"><span class="token interpolation-punctuation punctuation">${</span>after<span class="token interpolation-punctuation punctuation">}</span></span><span class="token template-punctuation string">`</span></span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// example output:</span>
<span class="token comment">// At 2025-03-09T03:00:00-07:00[America/Los_Angeles] the offset will change from UTC -08:00 to -07:00</span></code></pre><h3 id="plainDateTimeISO"><a class="heading-link" href="#plainDateTimeISO"></a>Temporal.Now.<strong>plainDateTimeISO</strong>(<em>timeZone</em>: object | string = Temporal.Now.timeZone()) : Temporal.PlainDateTime</h3><p><strong>Parameters:</strong></p>
<span class="token comment">// At 2025-03-09T03:00:00-07:00[America/Los_Angeles] the offset will change from UTC -08:00 to -07:00</span></code></pre><h3 id="plainDateTimeISO"><a class="heading-link" href="#plainDateTimeISO"></a>Temporal.Now.<strong>plainDateTimeISO</strong>(<em>timeZone</em>: object | string = Temporal.Now.timeZoneId()) : Temporal.PlainDateTime</h3><p><strong>Parameters:</strong></p>
<ul>
<li><code>timeZone</code> (optional string or <code>Temporal.ZonedDateTime</code>): The time zone to get the current date and time in, as a time zone identifier, or a <code>Temporal.ZonedDateTime</code> object whose time zone will be used.
If not given, the current system time zone will be used.</li>
Expand All @@ -246,7 +246,7 @@ <h2 id="methods"><a class="heading-link" href="#methods"></a>Methods</h3><h3 id=
<span class="token comment">// London: 2020-01-25T05:52:14.758534756</span>
<span class="token comment">// Tokyo: 2020-01-25T14:52:14.759534758</span></code></pre><!-- prettier-ignore-end -->

<h3 id="plainDateISO"><a class="heading-link" href="#plainDateISO"></a>Temporal.Now.<strong>plainDateISO</strong>(<em>timeZone</em>: object | string = Temporal.Now.timeZone()) : Temporal.PlainDate</h3><p><strong>Parameters:</strong></p>
<h3 id="plainDateISO"><a class="heading-link" href="#plainDateISO"></a>Temporal.Now.<strong>plainDateISO</strong>(<em>timeZone</em>: object | string = Temporal.Now.timeZoneId()) : Temporal.PlainDate</h3><p><strong>Parameters:</strong></p>
<ul>
<li><code>timeZone</code> (optional string or <code>Temporal.ZonedDateTime</code>): The time zone to get the current date and time in, as a time zone identifier, or a <code>Temporal.ZonedDateTime</code> object whose time zone will be used.
If not given, the current system time zone will be used.</li>
Expand All @@ -263,7 +263,7 @@ <h3 id="plainDateISO"><a class="heading-link" href="#plainDateISO"></a>Temporal.

<span class="token comment">// Is it Nowruz (New Year in the Persian calendar)?</span>
date <span class="token operator">=</span> Temporal<span class="token punctuation">.</span>Now<span class="token punctuation">.</span><span class="token function">plainDateISO</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">withCalendar</span><span class="token punctuation">(</span><span class="token string">'persian'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>date<span class="token punctuation">.</span>month <span class="token operator">===</span> <span class="token number">1</span> <span class="token operator">&amp;&amp;</span> date<span class="token punctuation">.</span>day <span class="token operator">===</span> <span class="token number">1</span><span class="token punctuation">)</span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'New year!'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre><h3 id="plainTimeISO"><a class="heading-link" href="#plainTimeISO"></a>Temporal.Now.<strong>plainTimeISO</strong>(<em>timeZone</em>: object | string = Temporal.Now.timeZone()) : Temporal.PlainTime</h3><p><strong>Parameters:</strong></p>
<span class="token keyword">if</span> <span class="token punctuation">(</span>date<span class="token punctuation">.</span>month <span class="token operator">===</span> <span class="token number">1</span> <span class="token operator">&amp;&amp;</span> date<span class="token punctuation">.</span>day <span class="token operator">===</span> <span class="token number">1</span><span class="token punctuation">)</span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'New year!'</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre><h3 id="plainTimeISO"><a class="heading-link" href="#plainTimeISO"></a>Temporal.Now.<strong>plainTimeISO</strong>(<em>timeZone</em>: object | string = Temporal.Now.timeZoneId()) : Temporal.PlainTime</h3><p><strong>Parameters:</strong></p>
<ul>
<li><code>timeZone</code> (optional string or <code>Temporal.ZonedDateTime</code>): The time zone to get the current date and time in, as a time zone identifier, or a <code>Temporal.ZonedDateTime</code> object whose time zone will be used.
If not given, the current system time zone will be used.</li>
Expand Down
2 changes: 1 addition & 1 deletion index.html

Large diffs are not rendered by default.

0 comments on commit ae51b85

Please sign in to comment.