Fixing fromDateToString function to verify date equals to undefined instead of null.