升级到 0.7.1 后,upickle 中的自定义 writer/reader 不再有效

Custom writer/reader in upickle no longer works after upgrade to 0.7.1

我有自己的自定义 DateTime class,为此我编写了以下自定义编写器和 reader:

val dtWriter = Writer[DateTime]{
    case t => Js.Str(format(t))
}
val dtReader = Reader[DateTime]{
    case Js.Str(time) =>
        try {
            parse(time)
        }
        catch {
            case _: Exception =>
                SDateTime(0)
        }
}

但是,我尝试将我的软件包版本从 0.4.4 升级到 0.7.1,但此代码不再编译并出现以下错误:

Error:(7, 8) object Js is not a member of package upickle

import upickle.Js

Error:(112, 23) object Writer does not take type parameters.

val dtWriter = Writer[DateTime]{

在最新版本的upickle中应该如何重写?

仅基于阅读 http://www.lihaoyi.com/upickle/#CustomPicklers

val dtRW = readwriter[String].bimap[DateTime](
  t => format(t), // also `format _` or just `format` should work
  time =>
    try {
        parse(time)
    }
    catch {
        case _: Exception =>
            SDateTime(0)
    }
)