Skip to content

Commit c38eb5a

Browse files
committed
converted DateTimeInterface to datetimezoneid
1 parent 618fae7 commit c38eb5a

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/ParameterHelper.php

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,14 @@
1313

1414
namespace Laudis\Neo4j;
1515

16-
use Bolt\structures\DateTime;
16+
use Bolt\structures\DateTimeZoneId;
1717
use Bolt\structures\Duration;
1818
use Bolt\structures\IStructure;
1919
use function count;
20-
use const DATE_ATOM;
21-
use function date_default_timezone_get;
2220
use DateInterval;
2321
use DateTimeInterface;
24-
use DateTimeZone;
2522
use function get_debug_type;
2623
use function gettype;
27-
use function gmdate;
2824
use InvalidArgumentException;
2925
use function is_array;
3026
use function is_int;
@@ -229,19 +225,10 @@ private static function convertTemporalTypes($value, bool $boltDriver): ?IStruct
229225
{
230226
if ($boltDriver) {
231227
if ($value instanceof DateTimeInterface) {
232-
$tz = $value->getTimezone();
233-
/** @var DateTimeInterface $gm */
234-
$gm = new \DateTime(gmdate(DATE_ATOM));
235-
if ($tz) {
236-
$tz = $tz->getOffset($gm);
237-
} else {
238-
$tz = (new DateTimeZone(date_default_timezone_get()))->getOffset($gm);
239-
}
240-
241-
return new DateTime(
228+
return new DateTimeZoneId(
242229
$value->getTimestamp(),
243230
((int) $value->format('u')) * 1000,
244-
$tz
231+
$value->getTimezone()->getName()
245232
);
246233
}
247234

0 commit comments

Comments
 (0)