Skip to content

Commit

Permalink
Merge branch '4.4' into 5.2
Browse files Browse the repository at this point in the history
* 4.4:
  skip intl dependent tests if the extension is missing
  make DateCaster tests timezone-agnostic
  error if the input string couldn't be parsed as a date
  IntegerType: Always use en for IntegerToLocalizedStringTransformer Fixes #40456
  Uses the correct assignment action for console options depending if they are short or long
  [HttpKernel] ConfigDataCollector to return known data without the need of a Kernel
  [HttpClient] fix using stream_copy_to_stream() with responses cast to php streams
  FIx Trying to clone an uncloneable object of class
  • Loading branch information
xabbuh committed Mar 28, 2021
2 parents 25b0e8e + 0da0e17 commit 89412a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Caster/DateCaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, bool $is
$dates = [];
foreach (clone $p as $i => $d) {
if (self::PERIOD_LIMIT === $i) {
$now = new \DateTimeImmutable();
$now = new \DateTimeImmutable('now', new \DateTimeZone('UTC'));
$dates[] = sprintf('%s more', ($end = $p->getEndDate())
? ceil(($end->format('U.u') - $d->format('U.u')) / ((int) $now->add($p->getDateInterval())->format('U.u') - (int) $now->format('U.u')))
: $p->recurrences - $i
Expand Down
2 changes: 1 addition & 1 deletion Tests/Caster/DateCasterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public function testDumpPeriod($start, $interval, $end, $options, $expected)
*/
public function testCastPeriod($start, $interval, $end, $options, $xPeriod, $xDates)
{
$p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), \is_int($end) ? $end : new \DateTime($end), $options);
$p = new \DatePeriod(new \DateTime($start, new \DateTimeZone('UTC')), new \DateInterval($interval), \is_int($end) ? $end : new \DateTime($end, new \DateTimeZone('UTC')), $options);
$stub = new Stub();

$cast = DateCaster::castPeriod($p, [], $stub, false, 0);
Expand Down

0 comments on commit 89412a6

Please sign in to comment.