package and depencies
This commit is contained in:
@@ -28,7 +28,7 @@ class DateCaster
|
||||
{
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
$location = $d->getTimezone()->getLocation();
|
||||
$fromNow = (new \DateTime())->diff($d);
|
||||
$fromNow = (new \DateTimeImmutable())->diff($d);
|
||||
|
||||
$title = $d->format('l, F j, Y')
|
||||
."\n".self::formatInterval($fromNow).' from now'
|
||||
@@ -79,7 +79,7 @@ class DateCaster
|
||||
public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stub, bool $isNested, int $filter)
|
||||
{
|
||||
$location = $timeZone->getLocation();
|
||||
$formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P');
|
||||
$formatted = (new \DateTimeImmutable('now', $timeZone))->format($location ? 'e (P)' : 'P');
|
||||
$title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code']) : '';
|
||||
|
||||
$z = [Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title)];
|
||||
|
Reference in New Issue
Block a user