From 3ed50a4d0728e785d397173a12a8aa70d1dded5f Mon Sep 17 00:00:00 2001 From: HorstOeko Date: Mon, 9 Dec 2024 16:39:59 +0100 Subject: [PATCH] [ENH] Use DateTime values with correct timezone --- src/ZugferdDocumentPdfBuilderAbstract.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ZugferdDocumentPdfBuilderAbstract.php b/src/ZugferdDocumentPdfBuilderAbstract.php index 78aeaaf7..ce555884 100644 --- a/src/ZugferdDocumentPdfBuilderAbstract.php +++ b/src/ZugferdDocumentPdfBuilderAbstract.php @@ -9,6 +9,7 @@ namespace horstoeko\zugferd; +use DateTime; use DOMDocument; use DOMXpath; use Throwable; @@ -501,7 +502,7 @@ private function preparePdfMetadata(): array 'title' => $title, 'subject' => $subject, 'createdDate' => $invoiceInformations['date'], - 'modifiedDate' => date('Y-m-d\TH:i:s') . '+00:00', + 'modifiedDate' => (new DateTime())->format('Y-m-d\TH:i:sP'), ); return $pdfMetadata; @@ -521,7 +522,7 @@ protected function extractInvoiceInformations(): array $dateXpath = $xpath->query('//rsm:ExchangedDocument/ram:IssueDateTime/udt:DateTimeString'); $date = $dateXpath->item(0)->nodeValue; - $dateReformatted = date('Y-m-d\TH:i:s', strtotime($date)) . '+00:00'; + $dateReformatted = (new DateTime())->setTimestamp(strtotime($date))->format('Y-m-d\TH:i:sP'); $invoiceIdXpath = $xpath->query('//rsm:ExchangedDocument/ram:ID'); $invoiceId = $invoiceIdXpath->item(0)->nodeValue;