How to return text formatted date using CommunityCommons SubstituteTemplate

2
I am trying to use the SubstituteTemplate function in the Community Commons (1.2) StringUtils, which works great except for with Date/Time fields. When substituting a date/time attribute I get the epoch seconds returned (like 1309271205640) instead of a string (like 8/16/2011 10.00 AM). Is there any way to change this behavior?
asked
2 answers
1

You can extend communitycommons.ORM.getValueOfPath with an extra argument (the date format string) and and extra if case (menber instanceof MendixDateTime) and then apply the dateformat. I think it requires only basic java skills to add that case.

Otherwise, file a feature request and I will add it in the next release.

UPDATE

Solved in the 2.1(.1) release in the appstore.

answered
0

This seems to be in the core (substituteTemplate calls getConstantValue) thus fixing Java does not work. The only way around seems to be to replace the Date field in the template with a string field and add an extra attribute to your entity representing the DateTime as String. Update this string field in a before commit event.

answered