added a check to changeToDate to see if string is empty