lundi 21 août 2017

DynamicReports doesn't apply pattern to format ZonedDateTime

I have a model class that contains field of type ZonedDateTime. When generate report data is shown as: 2017-08-17T16:09:03+03:00[Europe/Chisinau]. To format that date I use method setPattern("dd.MM.yyyy") but nothing changes.

All stuff is generated via reflection, check source:

for (Field field : entityClass.getDeclaredFields()) {
    String fieldName = field.getName();
    if (usedFields.contains(fieldName)) {
        field.setAccessible(true);
        if(field.getType().isAssignableFrom(Date.class) || field.getType().isAssignableFrom(ZonedDateTime.class)){
            report.addColumn(Columns.column(fieldName, fieldName, field.getType()).setPattern("dd.MM.yyyy"));
        }else {
            report.addColumn(Columns.column(fieldName, fieldName, field.getType()));
        }
    }
}

Any ideas?

Thanks.

Aucun commentaire:

Enregistrer un commentaire