[php-src] Issue #10843: Wrong calculation of duration in NumberFormatter on rounding up
| From: | marc-mabe | Date: | Mon, 13 Mar 2023 13:54:25 +0000 |
| Subject: | [php-src] Issue #10843: Wrong calculation of duration in NumberFormatter on rounding up | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243904@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10843
Author: marc-mabe
### Description
The following code:
https://3v4l.org/unbsD
```php
<?php
$formatter = new NumberFormatter('en', NumberFormatter::DURATION);
var_dump($formatter->format(1234.0));
var_dump($formatter->format(1234.5));
var_dump($formatter->format(1234.5678));
var_dump($formatter->format(1235));
```
Resulted in this output:
```
string(5) "20:34"
string(5) "21:34"
string(5) "21:35"
string(5) "20:35"
```
But I expected this output instead:
```
string(5) "20:34"
string(5) "20:35"
string(5) "20:35"
string(5) "20:35"
```
### PHP Version
PHP 8.X
### Operating System
Linux