Closed richardhj closed 8 years ago
You're right, the correct solution would be to pass date_default_timezone_get()
if the argument is null
Don't passing $timezone
is a solution too. Because of the @date_default_timezone_set(Config::get('timeZone'));
in the initialize.php
, the right timezone will be applied, wouldn't it?
Correct. Then we would need to if/else the method call.
I have another point belonging to this.
The method returns a \DateTime
instance, should it not be a Haste\DateTime\DateTime
instance (to use getAge()
right from this context)?
This is what it could like:
$objDate = new self();
$objDate->setTimestamp($tstamp);
return $objDate;
Sounds reasonable
Should be fixed in 211bc90. Can you confirm?
It works great. Thanks!
The method has just been deprecated. You should simply use new DateTime('@' . $timestamp)
.
This is the function:
If s.o. calls
::createFromTimestamp()
without the second parameter$timezone
, your function will callstatic::createFromFormat('U', $tstamp, null);
This leads to a PHP Warning (DateTime::createFromFormat() expects parameter 3 to be DateTimeZone, null given). Even if it's just a warning, the method will returnbool(false)
instead of aDateTime object