I want to use Dates in shared code (JVM and JS).
So I need the functionality to parse a Date from a Text and to format a Text from a Date.
I found that ScalaJS supports java.util.Date and java.util.Formatter, but with this there is no way to parse a Text to a Date.
Is it possible to have this in shared code? Or what is the best practice to handle dates in this scenario.
You can use the
java.timeAPIs through https://github.com/cquiroz/scala-java-time to manipulate date/time in a cross-platform way.For parsing, use the
java.textAPIs through https://github.com/cquiroz/scala-java-locales.