Valid formats for displaying jodaDate in Play 2.5

I am trying to use date mappings in a PlayFramework and a datetime-local field. Docs here

The truncated mapping looks like this: with several parameters that I tried for the validator.

mapping(
  "startTimeGt" -> optional(jodaDate),
  "startTimeLt" -> optional(jodaDate("dd-MM-yyyy HH:mm"))
)(...

I tried both the associated inputDate helper and the datetime-local field.

But no matter what combination I try, I get error.datein the submit form. I feel that it should be simple, and either I'm missing something in the documents, or they just don't tell me. Has anyone got a working example of the required html and mapping jodaDate?

+4
source share
2 answers

, formWithErrors

"startTimeLt" -> optional(jodaDate("dd-MM-yyyy HH:mm"))// the format maybe wrong

jodaDate, . , ,

def index() { implicit request =>
    println(request)//it will print the request content and you can find the "startTimeLt" to verify its format
    form.bindFromRequest.fold...
}

.

+1

: 03-06-2016T00:00 , , - : dd-MM-yyyy'T'HH:mm.

P.S.: , java8 localDateTime, joda Play 2.6.

+1

All Articles