Skip to content

Commit

Permalink
DateTime: build from timestamp use method setTimestamp(), keep defaul…
Browse files Browse the repository at this point in the history
…t timezone (#300)
  • Loading branch information
h4kuna authored and dg committed Sep 19, 2023
1 parent 0d93403 commit cead663
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Utils/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static function from(string|int|\DateTimeInterface|null $time): static
$time += time();
}

return (new static('@' . $time))->setTimezone(new \DateTimeZone(date_default_timezone_get()));
return (new static)->setTimestamp((int) $time);

} else { // textual or null
return new static((string) $time);
Expand Down

0 comments on commit cead663

Please sign in to comment.