Wicket - strange behavior with parameterized StringResourceModel
-
22-06-2021 - |
Pergunta
This is my resource key:
Expired {0} days ago
This is the definition of the StringResourceModel:
new StringResourceModel("store.expired.tooltip", null, Days.daysBetween(expirationDate, refDate));
Expected result would be something like Expired 20 days
ago but the actual result is Expired P20D ago
.
Any idea what is causing this? I think I do everything right but not sure.
Solução
This is actually an error in your usage of joda-time. See the javadoc for joda Days.
Days.daysBetween(expirationDate, refDate)
returns a joda Days
object, whose toString()
method returns ISO8601 duration format string, which is what you're seeing.
Using Days.daysBetween(expirationDate, refDate).getDays()
instead will make it an integer, which should format correctly.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow