Use isNaN in toTimeString method