File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ class DateTime extends \DateTime implements \JsonSerializable
4545 public static function from (string |int |\DateTimeInterface |null $ time ): static
4646 {
4747 if ($ time instanceof \DateTimeInterface) {
48- return new static ( $ time -> format ( ' Y-m-d H:i:s.u ' ), $ time-> getTimezone () );
48+ return static :: createFromInterface ( $ time );
4949
5050 } elseif (is_numeric ($ time )) {
5151 if ($ time <= self ::YEAR ) {
@@ -96,10 +96,7 @@ public static function createFromFormat(
9696 string |\DateTimeZone |null $ timezone = null ,
9797 ): static |false
9898 {
99- if ($ timezone === null ) {
100- $ timezone = new \DateTimeZone (date_default_timezone_get ());
101-
102- } elseif (is_string ($ timezone )) {
99+ if (is_string ($ timezone )) {
103100 $ timezone = new \DateTimeZone ($ timezone );
104101 }
105102
You can’t perform that action at this time.
0 commit comments