BUG: Fix first_last_valid_index, now preserves the frequency.
Checklist

- [X] closes #20499
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

I'm not sure if I should add a test somewhere else. Notice that I've added a new function [`_find_first_valid`](https://github.com/mmngreco/pandas/blob/ff8d3964cba04ed08f9f3b0dee3ee5c7514b5ed7/pandas/core/generic.py#L8766-L8785).