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
We should investigate implementing the java.time.* APIs in terms of Temporal. If successful, it may improve performance and more importantly help solve #69 by reducing the size of the generated JS code.
Although the Temporal APIs are not yet available it is in the process of implementation in browsers and the API is not expected to change.
There are currently polyfills which we can target for initial experiments. In http4s/http4s-dom#30 (comment) I estimated the size of scala-java-time to be roughly 100kb; meanwhile, this polyfill boasts a size of 15 kb. So that's something to think about :)
The text was updated successfully, but these errors were encountered:
Hmm, this might not be possible at all 😕 I ran into problems really quickly.
Compare:
scala> java.time.Instant.ofEpochSecond(31556889864403199L)
val res0: java.time.Instant = +1000000000-12-31T23:59:59Z
With:
> Temporal.Instant.fromEpochSeconds(BigInt('31556889864403199'))
Uncaught TypeError: Cannot convert BigInt to number
> Temporal.Instant.fromEpochMicroseconds(BigInt('31556889864403199') * BigInt(1000000))
Uncaught RangeError: Instant outside of supported range
So I think scala-java-time must continue to serve as the de facto compliant implementation of java.time.* on Scala.js.
Meanwhile, Temporal could be used to implement a non-compliant java.time.* similar to scalajs-jsjoda. But that seems outside the scope of this project.
This is a proposal for a JS-native date/time API:
We should investigate implementing the
java.time.*
APIs in terms of Temporal. If successful, it may improve performance and more importantly help solve #69 by reducing the size of the generated JS code.Although the Temporal APIs are not yet available it is in the process of implementation in browsers and the API is not expected to change.
There are currently polyfills which we can target for initial experiments. In http4s/http4s-dom#30 (comment) I estimated the size of scala-java-time to be roughly 100kb; meanwhile, this polyfill boasts a size of 15 kb. So that's something to think about :)
The text was updated successfully, but these errors were encountered: