Question

I am developing a groovy application and I am having problems when showing a Date field.

If I use the following notation:

<g:formatDate format="dd.MM.yyyy" date="${fieldValue(bean: incidentTicketSLAInstance, field: "erstellungsDatum")}"/>                     

I am getting the actual date instead of what is saved at the DB.

When I use this notation it works properly.

<g:formatDate format="dd.MM.yyyy" date="${incidentTicketSLAInstance?.erstellungsDatum}" />

am I doing something wrong here? Are not both notations equivalent? (BTW, the instance DO exists and erstellungsDatum is NOT null)

Thanks in advance,

Luis

Was it helpful?

Solution

the fieldValue call will return a String, not a Date object, which the makes formatDate not work correctly

You have to use the second notation (as you spotted)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top