-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x-mask custom decimal precision #3415
Conversation
Looks good. Maybe at this point it needs to be made into an options object? |
I've changed the $money helper to accept an options object as the second parameter. The delimiter and thousands params can also be passed trough the options object: Calls like |
Hey @Restartz, thanks for this. I actually prefer the 4th param instead of the options object. Can you remove all the options object stuff and we'll merge? Thanks! Oh, and can you also add documentation for this? |
Changed formatMoney to accept an options object as the second parameter while also allowing backwards compatibility for any formatMoney(input, delimiter = '.', thousands) calls updated tests to use options object fixed typos in test add test based on initial value fix initial value test
This reverts commit c83b807.
@Restartz it looks like there are also some merge conflicts. Can you merge the latest main branch changes in to your branch? Once that and docs sorted, then I can merge 🙂 |
@joshhanley Done and done! 🙂 |
@Restartz thanks! |
Allows for custom decimal precision using x-mask $money magic as requested here: #2873
Example usage:
<input x-data x-mask:dynamic="$money($input, '.', ',', 3)">
<input x-data x-mask:dynamic="$money($input, '.', ',', 0)">
It defaults to 2, so the current behaviour without specified precision should still be the same:
<input x-data x-mask:dynamic="$money($input)">