zoepepper / scalajs-jsjoda Goto Github PK
View Code? Open in Web Editor NEWScala.js facade for JS-Joda with drop-in to use it as JSR310 implementation.
Scala.js facade for JS-Joda with drop-in to use it as JSR310 implementation.
At least for java.time.LocalDate and java.time.Month, the equals function does not seem to work properly.
Looking at the code of LocalDate, equals is implemented by calling com.zoepepper.facades.jsjoda.LocalDate.equals. That, in turn, is not implemented at all, thus probably falling back to reference identity. The function isEqual, however, is implemented. Perhaps that one should be used instead?
When porting some JVM code to JS I was hit by a method DateTimeFormatter.ofLocalizedDateTime not implemented. Would it be possible to add it?
What alternatives does one have without it to get locale dependent long or short time formats?
It seems version 1.2.0 of scalajs-jsjoda-as-java-time is published for both 1.0 and 0.6 (see https://mvnrepository.com/artifact/com.zoepepper/scalajs-jsjoda-as-java-time), but when I try to use it with a 0.6.33 version, I get following error:
[error] org.scalajs.core.ir.IRVersionNotSupportedException: Failed to deserialize info of file compiled with Scala.js 1.1 (supported: 0.6.0, 0.6.13, 0.6.3, 0.6.17, 0.6.4, 0.6.6, 0.6.14, 0.6.8, 0.6.29, 0.6.5, 0.6.15): /home/runner/.cache/coursier/v1/https/repo1.maven.org/maven2/com/zoepepper/scalajs-jsjoda-as-java-time_sjs0.6_2.12/1.2.0/scalajs-jsjoda-as-java-time_sjs0.6_2.12-1.2.0.jar:java/time/chrono/package.sjsir
See https://github.com/OpenGrabeso/cohubo/runs/1026884673, which is a build of https://github.com/OpenGrabeso/cohubo
It seems I can use scalajs-jsjoda version 1.2.0 just fine, but not scalajs-jsjoda-as-java-time.
I would like to know what OSS license this repository is using.
Because I would like to contribute new feature/bugfix, or fork if this repository is no longer maintained.
Thanks for years of working.
Currently the facade is supported by [email protected]. Recently this usage has been deprecated.
All js-joda libraries are moved and put all js-joda npm modules under the @js-joda scope. (https://github.com/js-joda/js-joda)
This does not work under sbt.
jsDependencies += "org.webjars.npm" % "js-joda__core" % "3.2.0" / "js-joda__core" minified "js-joda__core.min.js"
jsDependencies += "org.webjars.npm" % "js-joda__timezone" % "2.5.0" / "js-joda__timezone" minified "js-joda__timezone.min.js"
The README currently has the installation instructions as:
libraryDependencies += "com.zoepepper" %%% "scalajs-jsjoda" % "1.1.1"
However there is no 1.1.1
version at https://repo1.maven.org/maven2/com/zoepepper/scalajs-jsjoda_sjs1_2.12/
Changing to 1.2.0
allows installation to succeed. However I don't see a 1.2.0
release in the repo so I'm questioning the validity of that install
libraryDependencies += "com.zoepepper" %%% "scalajs-jsjoda" % "1.2.0"
Hello!
Your project looks as a really promising tool for cross-platform time-based business logic. But I came across following issue.
Here's a simple scalajs program:
// notice original facade imports
import com.zoepepper.facades.jsjoda.ZonedDateTime
import com.zoepepper.facades.jsjoda.temporal.ChronoUnit
import scala.scalajs.js.annotation.{JSExport, JSExportTopLevel}
object Main {
@JSExportTopLevel("joda.Main")
protected def getInstance(): this.type = this
@JSExport
def main(): Unit = {
val t1 = ZonedDateTime.now()
val t2 = ZonedDateTime.now().plusDays(1L)
println(t1.until(t2, ChronoUnit.MINUTES))
}
}
It works fine. But when I change imports to java.time._
to use the drop-in, I get link error:
// notice changed imports
import java.time.ZonedDateTime
import java.time.temporal.ChronoUnit
// ... previous code unchanged
Referring to non-existent method java.time.temporal.Temporal.until(java.time.temporal.Temporal,java.time.temporal.TemporalUnit)scala.Long
This makes it very hard to use in cross-platform context. Do you have any ideas for how this can be fixed/worked around?
Instant.from gives me a compile error: Referring to non-existent method java.time.Instant$.from(java.time.temporal.TemporalAccessor)java.time.Instant
Looks like the scalajs-jsjoda facade method is different from the original java method, hence the compile error.
jsjoda: java.time.Instant.from(temporal: Temporal)
orinal java: java.time.Instant.from(temporal: TemporalAccessor)
Is this done deliberately? If yes, why?
I can work-around this issue by using LocalDateTIme.from(...).toInstant(ZoneOffset.UTC) or by ZonedDateTime.
I'm getting a linker error when I use LocalTime.MIDNIGHT in ScalaJs:
[cosmere] $ test:fastOptJS
[info] Compiling 1 Scala source to D:\extradash\src\pathfinder2\nexus\js\target\scala-2.11\classes...
[info] Fast optimizing D:\extradash\src\pathfinder2\midgar\modules\cosmere\chart-client\target\scala-2.11\cosmere-chart-client-test-fastopt.js
[error] Referring to non-existent method java.time.LocalTime$.MIDNIGHT()java.time.LocalTime
[error] called from com.extrategic.pathfinder.TradingSession$.()
Do you know why?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.