You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This helper will be used with x-spread and it's meant to be used instead of x-model on input field, for example x-spread="$mask('foo,' 'creditcard'). It will return 2 directives, x-on:input="foo = $parse(event.target.value, 'creditcard'); event.target.value=$format(foo, 'creditcard')" to replace x-model and x-bind:value="$format(foo, 'creditcard')" to initialise the value.
$format will take the raw value and format it for the user (1234567890123456 => 1234 5678 9012 3456), parse will take the formattrd value and convert it to raw (1234 5678 0912 3456 => 1234567890123456).
I'm thinking about starting with credit card since it shouldn't be to complex, then adding money format and date (maybe supporting custom date format, I'm still thinking about that).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This helper will be used with x-spread and it's meant to be used instead of x-model on input field, for example
x-spread="$mask('foo,' 'creditcard')
. It will return 2 directives,x-on:input="foo = $parse(event.target.value, 'creditcard'); event.target.value=$format(foo, 'creditcard')"
to replace x-model andx-bind:value="$format(foo, 'creditcard')"
to initialise the value.$format will take the raw value and format it for the user (1234567890123456 => 1234 5678 9012 3456), parse will take the formattrd value and convert it to raw (1234 5678 0912 3456 => 1234567890123456).
I'm thinking about starting with credit card since it shouldn't be to complex, then adding money format and date (maybe supporting custom date format, I'm still thinking about that).
Beta Was this translation helpful? Give feedback.
All reactions