Decimal separator to comma instead of dot
Hey all,
In my country we use comma as a decimal separator instead of a dot. So I would like to ask: how to change de price display/input to get and set with a comma as a decimal separator?
Doing this on a resource level with masks for input transformation seem like an overkill.
Thanks!
5 Replies
$money($input, '.', ',', 2)
this is the main part. You can specify it to be whatever you wantFilament uses alpine.js. Have a look here => https://alpinejs.dev/plugins/mask#:~:text=You%20may%20also%20choose%20to%20override%20the%20thousands%20separator%20by%20supplying%20a%20third%20optional%20argument%3A
Mask — Alpine.js
Automatically format text fields as users type
@K R A T O S thank you for your input, but I'll have to adapt this logic to a bunch of forms and tables. I thought that maybe there could be a cast or mutator on the Model level that could affect this.
In Europe it's really common to have comma as a separator
*decimal separator
I mean, You could do it with simple string manipulation as well, But if you want filament's text input to give you the currency in a specific format, this is the filament way to do it.
Thank you @K R A T O S . This isn't a currency use case, but clinical information for calculations. So, using string manipulation affect the calculation possibility and leads to more logic behind the scenes
Thanks for your input though!