Skip to content

Commit

Permalink
DateUtils::millisecondsToString int type cast when calling secondsToS…
Browse files Browse the repository at this point in the history
…tring to fix the deprecated: Implicit conversion from float
  • Loading branch information
mathieu-ducrot committed May 29, 2024
1 parent 62326d0 commit c1b80fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
CHANGELOG for 1.x
===================
## v1.4.1 - (2024-05-29)
### Fixed
- `DateUtils::millisecondsToString` int type cast when calling **secondsToString** to fix the deprecated: Implicit conversion from float

## v1.4.0 - (2024-05-06)
### Added
- `PhpFormatter` common date formatting to use on DateTime::format https://www.php.net/manual/en/datetime.format.php

## v1.3.0 - (2024-04-29)
Expand Down
2 changes: 1 addition & 1 deletion src/Utils/DateUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ public static function millisecondsToString(?int $value): ?string
if ($value === null) {
return null;
}
$toReturn = self::secondsToString($value / 1000); // We reduce it to the seconds to benefit from secondsToString
$toReturn = self::secondsToString((int) ($value / 1000)); // We reduce it to the seconds to benefit from secondsToString
if ($value > 60000) { // We act that printing the number of ms is only relevant if the $value is under a minute.
return $toReturn;
} elseif ($value < 1000) { // If inferior to 1 second we remove the '0s'
Expand Down

0 comments on commit c1b80fe

Please sign in to comment.