Fix #20083: Fix deprecated warning implicit conversion from float

This commit is contained in:
skepticspriggan
2024-04-02 23:40:02 +02:00
committed by GitHub
parent e9a93a82ec
commit e56e777325
3 changed files with 3 additions and 1 deletions

View File

@ -20,6 +20,7 @@ Yii Framework 2 Change Log
- Enh #20042: Add empty array check to `ActiveQueryTrait::findWith()` (renkas)
- Enh #20032: Added `yii\helpers\BaseStringHelper::mask()` method for string masking with multibyte support (salehhashemi1992)
- Enh #20034: Added `yii\helpers\BaseStringHelper::findBetween()` to retrieve a substring that lies between two strings (salehhashemi1992)
- Bug #20083: Fix deprecated warning implicit conversion from float (skepticspriggan)
- Enh #20121: Added `yiisoft/yii2-coding-standards` to composer `require-dev` and lint code to comply with PSR12 (razvanphp)
- Enh #20134: Raise minimum `PHP` version to `7.3` (@terabytesoftw)
- Bug #20141: Update `ezyang/htmlpurifier` dependency to version `4.17` (@terabytesoftw)

View File

@ -1059,7 +1059,7 @@ class Formatter extends Component
} elseif (is_numeric($value)) {
$isNegative = $value < 0;
$zeroDateTime = (new DateTime())->setTimestamp(0);
$valueDateTime = (new DateTime())->setTimestamp(abs($value));
$valueDateTime = (new DateTime())->setTimestamp(abs((int) $value));
$interval = $valueDateTime->diff($zeroDateTime);
} elseif (strncmp($value, 'P-', 2) === 0) {
$interval = new DateInterval('P' . substr($value, 2));