Add support for the exported date format on wordBuilder
This commit is contained in:
parent
fc71e95cf3
commit
8524bce2e0
|
@ -25,9 +25,12 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.format.DateTimeParseException;
|
||||||
|
import java.time.temporal.TemporalAccessor;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -352,8 +355,15 @@ public class WordBuilder {
|
||||||
if (field.getValue() == null || field.getValue().equals("false")) return null;
|
if (field.getValue() == null || field.getValue().equals("false")) return null;
|
||||||
return data.getLabel();
|
return data.getLabel();
|
||||||
case "datepicker":
|
case "datepicker":
|
||||||
case "datePicker":
|
case "datePicker":{
|
||||||
return field.getValue() != null ? DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.systemDefault()).format(Instant.parse((String)field.getValue())) : "";
|
Instant instant;
|
||||||
|
try {
|
||||||
|
instant = Instant.parse((String) field.getValue());
|
||||||
|
} catch (DateTimeParseException ex) {
|
||||||
|
instant = (Instant) DateTimeFormatter.ofPattern("yyyy-MM-dd").parse((String)field.getValue());
|
||||||
|
}
|
||||||
|
return field.getValue() != null ? DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.systemDefault()).format(instant) : "";
|
||||||
|
}
|
||||||
case "freetext":
|
case "freetext":
|
||||||
case "textarea":
|
case "textarea":
|
||||||
case "richTextarea":
|
case "richTextarea":
|
||||||
|
|
Loading…
Reference in New Issue