Skip to content

Commit a60ff92

Browse files
committed
corrected reading of date
1 parent c3a5f0e commit a60ff92

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,8 @@ public Invoice extractInto(Invoice zpp) throws XPathExpressionException, ParseEx
721721
}
722722
if((additionalChilds.item(additionalChildIndex).getLocalName() != null)
723723
&& (additionalChilds.item(additionalChildIndex).getLocalName().equals("FormattedIssueDateTime"))) {
724-
NodeList FormattedIssueDateTimeChilds = headerTradeAgreementChilds.item(agreementChildIndex).getChildNodes();
724+
725+
NodeList FormattedIssueDateTimeChilds = additionalChilds.item(additionalChildIndex).getChildNodes();
725726
for (int dateChildIndex = 0; dateChildIndex < FormattedIssueDateTimeChilds.getLength(); dateChildIndex++){
726727
if((FormattedIssueDateTimeChilds.item(dateChildIndex).getLocalName() != null)
727728
&& (FormattedIssueDateTimeChilds.item(dateChildIndex).getLocalName().equals("DateTimeString"))) {

library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*/
2121
package org.mustangproject.ZUGFeRD;
2222

23+
import com.fasterxml.jackson.core.JsonProcessingException;
2324
import com.fasterxml.jackson.databind.ObjectMapper;
2425

2526
import org.junit.jupiter.api.Test;
@@ -178,7 +179,7 @@ public void testEdgeInvoiceImport() {
178179
hasExceptions = true;
179180
}
180181
assertFalse(hasExceptions);
181-
SimpleDateFormat sdf=new SimpleDateFormat("YYYY-mm-dd");
182+
SimpleDateFormat sdf=new SimpleDateFormat("YYYY-MM-dd");
182183
// Reading ZUGFeRD
183184
assertEquals("4711", invoice.getZFItems()[0].getProduct().getSellerAssignedID());
184185
assertEquals("9384", invoice.getSellerOrderReferencedDocumentID());
@@ -188,6 +189,9 @@ public void testEdgeInvoiceImport() {
188189
assertEquals("recipient@test.org", invoice.getRecipient().getEmail());
189190
assertEquals("28934", invoice.getBuyerOrderReferencedDocumentID());
190191

192+
193+
194+
191195
}
192196

193197

0 commit comments

Comments
 (0)