I have an input field for a datepicker - the user can enter the minutes using the keyboard and when they enter a value less than 10 it will auto prepend the inital zero - so the time time 10:1
looks like 10:01
(there is an hour input and an minute input field) - the problem I have is it displays the zero instantly so it makes it difficult for editing the minute field with different values - how is the best way to delay to displayMinute function using a timeout or similar method so that when called it delays executing this by a second or so?
// function to prepend 0 to a minute if the minute is under 10
Calendar.prototype.displayMinute = function (minute) {
minute = (minute < 10) ? '0' + minute : minute;
return minute;
};
template: "<input type=\"text\" (keyup)='updateMinuteInput($event)' [value]=\"displayMinute(currentMinute)\" >\n",