A field for Brazilian money: the person types digits and the field shows R$ 1.234,56, the last two
digits being the cents (DevactionUI.MoneyMask in assets/js/devaction_ui). What is sent is the text as
shown; the server reads it with parse/1.
Summary
Functions
The amount of a masked text in cents, or :error when it holds no digits. Cents are an integer, so
nothing here depends on a decimal library.
Functions
Attributes
id(:string) (required)name(:string) (required)value(:string) - Defaults to"".label(:string) (required)errors(:list) - messages to show under the field. Defaults to[].class(:any) - Defaults tonil.- Global attributes are accepted.
@spec parse(String.t() | nil) :: {:ok, non_neg_integer()} | :error
The amount of a masked text in cents, or :error when it holds no digits. Cents are an integer, so
nothing here depends on a decimal library.
iex> DevactionUI.MoneyInput.parse("R$ 1.234,56")
{:ok, 123_456}