nscala-time 和 Java 8 数据时间之间的 Scala 日期时间

Scala datetime between nscala-time and Java 8 data time

如果在Java 8 发布之前,我肯定会选择 nscala-time 作为我的 scala play 项目。

但是自从 Java 8 发布后,建议使用 Java 8 数据和时间而不是 Java 项目的 joda 时间。

那么 Scala 项目呢?我们应该坚持使用 nscala-time 还是切换?如果使用Java8位日期和时间,需要使用mutable.

还有,哪个库对playjson库支持好?

Java 8个时间库(java.time)类型是不可变的; Joda Time 实际上有一些针对特定用例的可变 类。还有a Scala wrapper for java.time which can be used together with a backport of java.time for Java 7. I have no experience with Play JSON, but according to the mailing list,

We should consider migrating to the JSR-310 types internally in Play 3.0 and recommending using java.time._ types in the documentation. It seems like the Reads/Writes implementations we have for those are pretty reasonable. We just need to make sure we add support for those types in other parts of the APIs

But, currently at least the implementation in 2.4.2 for java.time.Instant Reads/Writes is buggy and I'm trying to get this fixed. So, maybe you want to join the discussion here: https://groups.google.com/forum/#!topic/play-framework/VFMTGPCW7Hc

所以现在看来​​使用 nscala-time(或直接使用 Joda)更有意义,尤其是如果您使用 Play 的其他部分,而不仅仅是 JSON。