Skip to content

Commit c290995

Browse files
committed
Fixed minor issue
1 parent 58506e3 commit c290995

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Cmfcmf/OpenWeatherMap/Util/Time.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ class Time
4747
public function __construct($from, $to = null)
4848
{
4949
if (isset($to)) {
50-
$from = (is_a($from, 'DateTime')) ? $from : new \DateTime($from);
51-
$to = (is_a($to, 'DateTime')) ? $to : new \DateTime($to);
50+
$from = (!is_string($from) && is_a($from, 'DateTime')) ? $from : new \DateTime($from);
51+
$to = (!is_string($to) && is_a($to, 'DateTime')) ? $to : new \DateTime($to);
5252
$day = new \DateTime($from->format('Y-m-d'));
5353
} else {
54-
$from = (is_a($from, 'DateTime')) ? $from : new \DateTime($from);
54+
$from = (!is_string($from) && is_a($from, 'DateTime')) ? $from : new \DateTime($from);
5555
$day = clone $from;
5656
$to = clone $from;
5757
$to = $to->add(new \DateInterval('PT23H59M59S'));
5858
}
59-
59+
6060
$this->from = $from;
6161
$this->to = $to;
6262
$this->day = $day;

0 commit comments

Comments
 (0)