Skip to content

Commit

Permalink
Merge branch '5.3' into 5.4
Browse files Browse the repository at this point in the history
* 5.3:
  Fix tests
  [VarExporter] escape unicode chars involved in directionality
  [Intl] Update the ICU data to 70.1
  Fix typos
  Update validators.ca.xlf
  Add missing Validator translations for Estonian
  Fix `Request::getUserInfo()` return type
  [VarDumper] Make dumping DateInterval instances timezone-independent
  Add missing validators translation in Brazillian Portuguese
  I heard you like some Finnish translations #43432
  fix typo and improve TH translation
  Added missing translations for Thai (th)
  [Messenger] Use `TransportMessageIdStamp` in `InMemoryTransport` allows retrying
  • Loading branch information
fabpot committed Nov 4, 2021
2 parents d9d1e52 + b7a9cc1 commit ae57e56
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Caster/DateCaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub,

public static function castInterval(\DateInterval $interval, array $a, Stub $stub, bool $isNested, int $filter)
{
$now = new \DateTimeImmutable();
$now = new \DateTimeImmutable('@0', new \DateTimeZone('UTC'));
$numberOfSeconds = $now->add($interval)->getTimestamp() - $now->getTimestamp();
$title = number_format($numberOfSeconds, 0, '.', ' ').'s';

Expand All @@ -63,7 +63,8 @@ private static function formatInterval(\DateInterval $i): string
$format = '%R ';

if (0 === $i->y && 0 === $i->m && ($i->h >= 24 || $i->i >= 60 || $i->s >= 60)) {
$i = date_diff($d = new \DateTime(), date_add(clone $d, $i)); // recalculate carry over points
$d = new \DateTimeImmutable('@0', new \DateTimeZone('UTC'));
$i = $d->diff($d->add($i)); // recalculate carry over points
$format .= 0 < $i->days ? '%ad ' : '';
} else {
$format .= ($i->y ? '%yy ' : '').($i->m ? '%mm ' : '').($i->d ? '%dd ' : '');
Expand Down

0 comments on commit ae57e56

Please sign in to comment.