sanniassin / react-input-mask

Input masking component for React. Made with attention to UX.
MIT License
2.22k stars 258 forks source link

Optional character in the middle (or prefix|suffix word) #187

Open adhenrique opened 5 years ago

adhenrique commented 5 years ago

Has anyone come across something like that? I tried to create a mask that contemplates 123 hours or 1234 hours, but it seems not to work well:

const formatChars = {
  "9": "[0-9]",
  "?": "[0-9 ]"
};
const mask = value.length <= 9 ? "999? hours" : "9999 hours";

When I type 123, it would be correct for the library to fill the rest of the field with hours, but it only fills if I type 1234.

Is my logic incorrect?

lucaashrq commented 4 years ago

Any update on this issue? I have the same problem. In the old version, works fine.

annezao commented 4 years ago

up

3runoDesign commented 4 years ago

up

lcsflrs commented 4 years ago

Any update on this issue? I have the same problem