Skip to content

Commit c4fa85b

Browse files
committed
Move formatter into string conversion block
1 parent ae42612 commit c4fa85b

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

app/code/Magento/Newsletter/Model/Queue.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ public function setQueueStartAtByString($startAt)
196196
if ($startAt === null || $startAt == '') {
197197
$this->setQueueStartAt(null);
198198
} else {
199-
$this->setQueueStartAt($this->timezone->convertConfigTimeToUtc($startAt));
199+
$startAt = $this->timezone->convertConfigTimeToUtc($startAt, null);
200+
$this->setQueueStartAt($startAt);
200201
}
201202
return $this;
202203
}

lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -309,21 +309,21 @@ public function formatDateTime(
309309
*/
310310
public function convertConfigTimeToUtc($date, $format = 'Y-m-d H:i:s')
311311
{
312-
$formatter = new \IntlDateFormatter(
313-
$this->_localeResolver->getLocale(),
314-
\IntlDateFormatter::MEDIUM,
315-
\IntlDateFormatter::MEDIUM,
316-
$this->getConfigTimezone(),
317-
null,
318-
null
319-
);
320-
$unixTime = $formatter->parse($date);
321-
$dateTime = new DateTime($this);
322-
323312
if (!($date instanceof \DateTimeInterface)) {
324313
if ($date instanceof \DateTimeImmutable) {
325314
$date = new \DateTime($date->format('Y-m-d H:i:s'), new \DateTimeZone($this->getConfigTimezone()));
326315
} else {
316+
$formatter = new \IntlDateFormatter(
317+
$this->_localeResolver->getLocale(),
318+
\IntlDateFormatter::MEDIUM,
319+
\IntlDateFormatter::MEDIUM,
320+
$this->getConfigTimezone(),
321+
null,
322+
$format
323+
);
324+
$unixTime = $formatter->parse($date);
325+
$dateTime = new DateTime($this);
326+
327327
$dateUniversal = $dateTime->gmtDate(null, $unixTime);
328328
$date = new \DateTime($dateUniversal, new \DateTimeZone($this->getConfigTimezone()));
329329
}

0 commit comments

Comments
 (0)