Skip to content

Commit

Permalink
[ENH] Use DateTime values with correct timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
HorstOeko committed Dec 9, 2024
1 parent 9f42bf5 commit 3ed50a4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ZugferdDocumentPdfBuilderAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace horstoeko\zugferd;

use DateTime;
use DOMDocument;
use DOMXpath;
use Throwable;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 3ed50a4

Please sign in to comment.