Getting error with datetimes if value is empty!