I want to make input for dateTime with mask and with autocomplete.
I've created small demo where the problem exists.
Looks like autocomplete thinks mask is a text... only if I finish input I can see some value from autocomplete (if it exists in autocomplete list).
Is there any solution?
<input name="field1" id="field1" class="inputmask" data-inputmask="'mask': 'h:s t\\m','placeholder': 'hh:mm xm', 'hourFormat': '12', 'alias': 'datetime'"/>
function generateTime(){
var times = [];
Array(24).join(',').split(',').forEach(function (_, index) {
var hour = index;
if (hour < 10) {
hour = '0' + hour;
}
times.push(moment(hour + ':00', 'HH:mm').format('hh:mm a'));
times.push(moment(hour + ':30', 'HH:mm').format('hh:mm a'));
});
return times;
}
$('.inputmask').inputmask();
$('.inputmask').autocomplete({
source: generateTime()
});
UPD :
Maybe some starting point for solution : In case I will add property 'autoUnmask' : true
AutoComplete will work only for "hours" - first symbols till my ":" in mask.