Use strlen instead of the cursor position to length-validate the date and time input.