diff --git a/src/Qbil/Models/Invoice.php b/src/Qbil/Models/Invoice.php index 9aa4a27..a4e62c0 100644 --- a/src/Qbil/Models/Invoice.php +++ b/src/Qbil/Models/Invoice.php @@ -18,8 +18,8 @@ public function __construct(Document $document) $this->supplierInvoiceNumber = $this->extract($document->HeaderFields, 'invoicenumber'); $this->amount = $this->extract($document->HeaderFields, 'invoicetotalvatexcludedamount'); $this->vatAmount = $this->extract($document->HeaderFields, 'invoicetotalvatamount'); - $this->invoiceDate = \DateTime::createFromFormat('Ymd', $this->extract($document->HeaderFields, 'invoicedate')); - $this->dueDate = \DateTime::createFromFormat('Ymd', $this->extract($document->HeaderFields, 'invoiceduedate')); + $this->invoiceDate = \DateTime::createFromFormat('Ymd', $this->extract($document->HeaderFields, 'invoicedate')) ?: null; + $this->dueDate = \DateTime::createFromFormat('Ymd', $this->extract($document->HeaderFields, 'invoiceduedate')) ?: null; $this->currency = $this->extract($document->HeaderFields, 'invoicecurrency'); $this->theirVatRegistration = $this->extract($document->HeaderFields, 'suppliervatregistrationnumber'); $this->ourVatRegistration = $this->extract($document->HeaderFields, 'CustomerVATRegistrationNumber');