I had a brain fart, here is the solution:
DateTime.parse(flash.get("startTime").getOrElse("01-01-1969")),
DateTime.parse(flash.get("endTime").getOrElse("01-01-1969")),
Вопрос
I have a field in the database that has a data type of DateTime's. I am trying to map my form helper to a Joda DateTime. I have that part down:
val transForm = Form(
mapping(
"startTime" -> jodaDate,
"endTime" -> jodaDate
)(TransactionFormData.apply)(TransactionFormData.unapply)
)
The problem occurs when I am trying to get the data from the flash scope:
flash.get("startTime").getOrElse(DateTime.parse("01-01-1969")), //need a fall back default value
flash.get("endTime").getOrElse(DateTime.parse("01-01-1969")),
Here is the error I receive on compile time:
type mismatch; found : Comparable[_ >: String with org.joda.time.ReadableInstant <: Comparable[_ >: String with org.joda.time.ReadableInstant <: Object]] with java.io.Serializable required: org.joda.time.DateTime
any ideas on how to correct this?
Решение
I had a brain fart, here is the solution:
DateTime.parse(flash.get("startTime").getOrElse("01-01-1969")),
DateTime.parse(flash.get("endTime").getOrElse("01-01-1969")),