donguy76
donguy76

Reputation: 640

Grails : Adding text color to g:formatDate

I am working on an app in Grails 2.3.6

I want to add text color to the Date object in GSP view. I tried the following and this didn't work.

<td><g:formatDate date="${myClassInstance.lastName}" style="color: green;"/></td>

Is there a way to add color to g:formatDate?

Upvotes: 0

Views: 249

Answers (1)

Joshua Moore
Joshua Moore

Reputation: 24776

Put your class on the surrounding element such as the td or add a <span></span> around your date. g:formatdate does not return HTML but rather just text.

<td style="color: green;"><g:formatDate date="${myClassInstance.lastName}"/></td>

or

<td><span style="color: green;"><g:formatDate date="${myClassInstance.lastName}"/></span></td>

Upvotes: 2

Related Questions