Milad Khajavi Milad Khajavi - 1 month ago 12
Scala Question

linking error on parsing java.time.LocalDate in scalajs

When I want to parse LocalDate in scalajs, linking error occur:

java.time.LocalDate.parse("2016-11-11")


here is the error message:

[error] Referring to non-existent method java.time.LocalDate$.parse(java.lang.CharSequence)java.time.LocalDate
[error] called from example.ScalaJSExample$$anonfun$myview$1.applyOrElse(scala.collection.immutable.List,scala.Function1)java.lang.Object
[error] called from example.ScalaJSExample$$anonfun$myview$1.applyOrElse(java.lang.Object,scala.Function1)java.lang.Object
[error] called from scala.concurrent.Future$class.$$anonfun$1(scala.concurrent.Future,scala.PartialFunction,scala.util.Try)java.lang.Object


but using java.time.LocalDate.of(2016,11,11) works without any error.

What is the problem?!

Answer

Because java.time.LocalDate.parse is not implemented. You might try another of the alternative libraries for java.time support, if one of them supports it. Otherwise, I guess you could contribute the implementation.