omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
262 stars 114 forks source link

Adding MoneyColumn to render currency based #235

Closed maxmishyn closed 1 year ago

maxmishyn commented 3 years ago

PR adds new type of column: MoneyColumn. It is a bit similar to NumberColumn but is more finetuned to render money type of fields, like prices, order totals etc. It shares locale settings with Symfony applications by utilizing intl extension's functionality.

curry684 commented 2 years ago

While I like the concept I'm not sure this is 'generic' enough to ship with the main package. We actually have a MoneyColumn implementation in several of our own projects, and none of them are identical.

IF we do this it has to be totally generic, future proof and valid for every country in the world. Is it? 😄

maxmishyn commented 2 years ago

@curry684, I tried to make it as much generic as possible. Yes, it should work in all countries for which Symfony's money formatting works. It covers different types of data storage like float "as is" or integer with some divider. It respects Symfony language/currency default setting as well as has ability to override it on per column basis using Symfony's/intl's locales.

curry684 commented 2 years ago

I enabled the test actions for the PR and the error it's giving I think already exposes a formatting issue because of system locale differences between your development machine and the CI runner. I18n formatting is really complex 😉

github-actions[bot] commented 1 year ago

Stale pull request message