Fix exceptions while typing in date using keyboard input