An AngularJs directive, that takes care of the input to accept numbers only to generate a "Time" value with the
format ( hh:mm:ss ).
The separator ":" is appended after "hh" and "mm" automatically ,thus restricting the user to enter 2 digit
value. (example : 23:59:59).
The directive also takes care , that the initial value is not be started with a separator(:).
The value of hour (ie : hh ) , if reached or more than "24", the model is automatically set to "23". Similarly , the values of Minutes and Seconds (ie : mm , ss ) , if reached or more than "60", the model is automatically set to "59".
On the final note, "timesOnly" directive, takes the input in numbers to form a Time value formatted (hh:mm:ss) (example : 26:59:59 ) , with inclusion of automatic separators.
PS: In addition to the input element, Remove button is attached, in order to refresh or reset the value.
<script src="https://gist.github.com/NishiBangar/3f6f65200e98f013094f378e7834a8b7.js"></script>
A Pen by Nishchith J Bangar on CodePen.