4
Guys I’m doing an hour validation on Javascript. I can’t type the following hours 14:00, 15:00, 16:00 until 20:00, but other hours I can get.
I’m doing like this:
var mask = "HH:MM",
pattern = {
'translation': {
'H': {
pattern: /[0-23]/
},
'M': {
pattern: /[0-59]/
}
}
};
$("#QuantidadeHoras").mask(mask, pattern);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.0/jquery.mask.min.js"></script>
<input type="text" id="QuantidadeHoras" />
Which library(s) you are using for mask and validation(s)?
– Allan Andrade
First of all this
0-23
regex does not understand it to be from 0 to 23, but from 0 to 2, which is why regex 0 2 is part of the "range" that Voce specified in the list. Your regex would match numbers from 0 to 2 followed by 3– Neuber Oliveira