Shorter:

```ruby
[dates].reject(&:blank?).detect { |d| ... }
```

`#blank?` is an ActiveSupport extension that returns true for nil, empty string, and strings that are runs of spaces.