Closed emlai closed 9 months ago
Hello, unfortunately, such a limitation exists, since the library parses the entered value for keys.
You can take a workaround by changing the key name in the replacement
field, like this:
<InputMask
mask="hh:mm XY"
replacement={{ h: /\d/, m: /\d/, X: /[AP]/, Y: /M/ }}
/>
or like this:
<InputMask
mask="tt:tt xm"
replacement={{ t: /\d/, x: /[AP]/, m: /M/ }}
/>
I'm using
useMask
from@react-input/mask
and trying to define a mask of the formhh:mm XM
to allow input such as10:00 AM
or10:00 PM
.I tried to define
replacement
as{ h: /\d/, m: /\d/, X: /[AP]/, M: /M/ }
but it doesn't allow typing the lastM
character. According to the docs any replacement character is ignored from the input.How can I allow typing
M
whileM
is also in the mask?