Skip to content

Filters: number() and bytes() with locale round half up like without locale - #427

Open
vosikar wants to merge 1 commit into
nette:masterfrom
vosikar:fix/number-bytes-rounding
Open

vosikar wants to merge 1 commit into
nette:masterfrom
vosikar:fix/number-bytes-rounding

Conversation

@vosikar

@vosikar vosikar commented Sep 30, 2026

Copy link
Copy Markdown

With a locale set |number and |bytes use NumberFormatter, which rounds half-even by default. Without a locale the number_format() / round() is used, which rounds half away from zero. The formatter now uses ROUND_HALFUP, so both round the same way. Covered by new tests.

{9.105|number:2} {* 9.11 without locale, 9,10 with cs *}

…locale, instead of NumberFormatter's default half-even
@vosikar vosikar changed the title Filters: number() and bytes() with locale round half up like without … Filters: number() and bytes() with locale round half up like without locale Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant