Skip to content

v2.1.0

Latest

Choose a tag to compare

@jsacksick jsacksick released this 23 Sep 09:38

Adds Currency::getDisplayFractionDigits(), separate from Currency::getFractionDigits():

  • getFractionDigits(): the ISO 4217 minor units, used for rounding and converting amounts to minor units (e.g. for payment gateways).
  • getDisplayFractionDigits(): the CLDR display digits, used by CurrencyFormatter as the default number of decimals. Falls back to getFractionDigits() when not set.

This restores the CLDR display digits that v2.0.10 replaced. COP, HUF, IDR, PKR, AFN, ALL, IQD, IRR, KPW, LAK, LBP, MGA, MMK, SOS, SYP and YER are formatted without their unused minor unit again (e.g. 9 505 Ft), while their fraction digits stay ISO 4217. Pass minimum_fraction_digits / maximum_fraction_digits to override.

Currency objects created without display_fraction_digits (e.g. by custom currency repositories) keep their current formatting.