From a60ff926ca72f0332a17f6bd9365e718b01b93d8 Mon Sep 17 00:00:00 2001 From: jstaerk Date: Mon, 20 Oct 2025 10:25:48 +0200 Subject: [PATCH] corrected reading of date --- .../org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java | 3 ++- .../org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java index ad862724..9b54612f 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java @@ -721,7 +721,8 @@ public class ZUGFeRDInvoiceImporter { } if((additionalChilds.item(additionalChildIndex).getLocalName() != null) && (additionalChilds.item(additionalChildIndex).getLocalName().equals("FormattedIssueDateTime"))) { - NodeList FormattedIssueDateTimeChilds = headerTradeAgreementChilds.item(agreementChildIndex).getChildNodes(); + + NodeList FormattedIssueDateTimeChilds = additionalChilds.item(additionalChildIndex).getChildNodes(); for (int dateChildIndex = 0; dateChildIndex < FormattedIssueDateTimeChilds.getLength(); dateChildIndex++){ if((FormattedIssueDateTimeChilds.item(dateChildIndex).getLocalName() != null) && (FormattedIssueDateTimeChilds.item(dateChildIndex).getLocalName().equals("DateTimeString"))) { diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java index ec744ec8..df10da24 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java @@ -20,6 +20,7 @@ */ package org.mustangproject.ZUGFeRD; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.jupiter.api.Test; @@ -178,7 +179,7 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase { hasExceptions = true; } assertFalse(hasExceptions); - SimpleDateFormat sdf=new SimpleDateFormat("YYYY-mm-dd"); + SimpleDateFormat sdf=new SimpleDateFormat("YYYY-MM-dd"); // Reading ZUGFeRD assertEquals("4711", invoice.getZFItems()[0].getProduct().getSellerAssignedID()); assertEquals("9384", invoice.getSellerOrderReferencedDocumentID()); @@ -188,6 +189,9 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase { assertEquals("recipient@test.org", invoice.getRecipient().getEmail()); assertEquals("28934", invoice.getBuyerOrderReferencedDocumentID()); + + + }