Distinction between ambiguous and nonexistent times · Issue #35 · js-temporal/proposal-temporal-v2 · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a way to distinguish the two failure cases for {disambiguation: 'reject'} (where, due to a clock change, either the local time in question can represent zero or two times).
Advantages of being able to distinguish the two cases:
Enable the UI to show an error when selecting a nonexistent time
Enable development of a UI to allow the user to make a specific choice when the time is ambiguous
However, technically the ability to distinguish is already possible with the workaround from chronotope/chrono#1701 (comment). The advantages of this proposal are:
Improve ergonomics
Improve performance (workaround requires 2-3 calls to ZonedDateTime.from and 1-2 .equals() comparisons between results)
Concerns:
None from me.
Prior art:
This is roughly analogous to a Rust library: chrono's MappedLocalTime. In fact, it is proposed here as a result of chronotope/chrono#1701 - where this distinction is not possible in Rust-WASM due to shortcomings of Date, and is possible with a workaround using Temporal-v1. This proposal only makes it ergonomic.
Constraints / corner cases:
n/a - this feature is all about handling a constraint/corner-case.
The text was updated successfully, but these errors were encountered:
Add a way to distinguish the two failure cases for
{disambiguation: 'reject'}
(where, due to a clock change, either the local time in question can represent zero or two times).This is a follow-up for tc39/proposal-temporal#3111.
Possible syntaxes:
Expected output, for either option, calling it
f
:Notably, this can already (with Temporal v1) be implemented by the workaround described in chronotope/chrono#1701 (comment).
Advantages:
Advantages of being able to distinguish the two cases:
However, technically the ability to distinguish is already possible with the workaround from chronotope/chrono#1701 (comment). The advantages of this proposal are:
ZonedDateTime.from
and 1-2.equals()
comparisons between results)Concerns:
None from me.
Prior art:
This is roughly analogous to a Rust library: chrono's
MappedLocalTime
. In fact, it is proposed here as a result of chronotope/chrono#1701 - where this distinction is not possible in Rust-WASM due to shortcomings ofDate
, and is possible with a workaround using Temporal-v1. This proposal only makes it ergonomic.Constraints / corner cases:
n/a - this feature is all about handling a constraint/corner-case.
The text was updated successfully, but these errors were encountered: