set timezone when auto-assigning date #106

This commit is contained in:
Enrique Zamudio
2018-04-17 12:29:26 -05:00
parent 70f2c89c3e
commit 2783dde094
@@ -240,9 +240,18 @@ public class MessageFactory<T extends IsoMessage> {
if (traceGen != null) {
m.setValue(11, traceGen.nextTrace(), IsoType.NUMERIC, 6);
}
if (setDate) {
m.setValue(7, new Date(), IsoType.DATE10, 10);
}
if (setDate) {
if (m.hasField(7)) {
//We may have a field with a timezone but no value
m.updateValue(7, new Date());
} else {
IsoValue<Date> now = new IsoValue<>(IsoType.DATE10, new Date());
if (DateTimeParseInfo.getDefaultTimeZone() != null) {
now.setTimeZone(DateTimeParseInfo.getDefaultTimeZone());
}
m.setField(7, now);
}
}
return m;
}