I'm using the jquery.inputmask plugin.
I need a mask for a time range in 12 hour format.
Example: 9:30 am - 10:00 pm
I know we can do something like this:
$(selector).inputmask("h:s t");
I was hoping to get something like this:
$(selector).inputmask("h:s t - h:s t"); // not working as intended
The closest I can get is this:
$(selector).inputmask("9{1,2}:99 aa - 9{1,2}:99 aa");
...but it's not ideal/perfect since this will pass: 33:44 mm - 55:66 nn
I found a solution after reading inputmask.date.extensions.js and added some adjustments:
$(selector).inputmask({
mask: "h:s t\\m - h:s t\\m",
placeholder: "hh:mm xm - hh:mm xm",
alias: "datetime",
hourFormat: "12"
});
This solution is not perfect since it gives me the leading zeros for the hours which I don't want, but at least it's better than this:
$(selector).inputmask("9{1,2}:99 aa - 9{1,2}:99 aa");