Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Jan 17, 2025
1 parent c7807b7 commit fc7de38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/Casts/DateTimeInterfaceCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ protected function castValue(
}

// Truncate nanoseconds to microseconds (first 6 digits)
// Input: 2024-12-02T16:20:15.969827247Z
$value = preg_replace('/\.(\d{6})\d*Z$/', '.$1Z', $value);
// Output: 2024-12-02T16:20:15.969827Z
if (is_string($value)) {
$value = preg_replace('/\.(\d{6})\d*Z$/', '.$1Z', $value);
}

/** @var DateTimeInterface|null $datetime */
$datetime = $formats
Expand Down
1 change: 0 additions & 1 deletion tests/Casts/DateTimeInterfaceCastTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
public DateTimeImmutable $dateTimeImmutable;
};


expect(
$caster->cast(
FakeDataStructureFactory::property($class, 'carbon'),
Expand Down

0 comments on commit fc7de38

Please sign in to comment.