moneyphp / money

PHP implementation of Fowler's Money pattern.
http://moneyphp.org
MIT License
4.56k stars 439 forks source link

Incorrect ‘minorUnit’ Value for Iranian Rial (IRR) #765

Closed AmirMehrabi closed 6 months ago

AmirMehrabi commented 6 months ago

Hello,

I came across this library which solves a big issue for me. I am developing a multilingual application and we needed such a library. Really thrilled to find this.

Anyways, I've come across an issue with the 'minorUnit' value specified for the Iranian Rial (IRR) in the currency array. The current implementation of the library specifies the 'minorUnit' for IRR as 2. This value implies that the currency should be divisible into 100 smaller units, which would be dinars.

However, this is not reflective of the practical usage and financial transactions within Iran. Due to inflation and the devaluation of the Iranian Rial over time, the dinar is no longer used in everyday transactions (I would say it hasn't been used in more than +100 years at least), and prices are not calculated to two decimal places. Instead, prices are rounded to the nearest Rial, and the Toman (which is equal to 10 Rials) is used informally for larger denominations (I would say even Rial is becoming obsolete and Toman has been the default currency for the past +5 decades).

The Issue:

Proposed Change:

By addressing this, the moneyphp/money library will provide more accurate financial information for developers working with IRR.

Thank you for taking the time to consider this issue. I look forward to your response and the resolution.

Best regards, Amir

frederikbosch commented 6 months ago

The currencies are derived from the package moneyphp/iso-currencies, which uses this data source. You can create your own implementation of the Currencies interface to overwrite this.