[Bug] Fix various DatetimeIndex comparison bugs
State: closed

Will have to see which issues this closes.  This is also a precursor to upcoming PR that dispatches DataFrame ops to Series (which in turn dispatches to Index).

Fixes #7830 (the OP's example is already fixed, this fixes examples in the comments to that issue)
Fixes DTI half of #19804

- [x] closes #7830
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Bug
name: Datetime
description: Datetime data dtype

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22074?src=pr&el=h1) Report
> Merging [#22074](https://codecov.io/gh/pandas-dev/pandas/pull/22074?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/26b3e7de56fdebaf1842b01d747a1a30a126c54a?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/22074/graphs/tree.svg?height=150&width=650&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/22074?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #22074      +/-   ##
==========================================
- Coverage   92.07%   92.06%   -0.01%     
==========================================
  Files         170      170              
  Lines       50688    50701      +13     
==========================================
+ Hits        46671    46679       +8     
- Misses       4017     4022       +5
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.47% <100%> (-0.01%)` | :arrow_down: |
| #single | `42.33% <45.83%> (+0.01%)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22074?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/22074/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `96.15% <100%> (+0.03%)` | :arrow_up: |
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/22074/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `95.52% <100%> (+0.06%)` | :arrow_up: |
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/22074/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `94.02% <0%> (-1.04%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/22074/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `95.54% <0%> (-0.14%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22074?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22074?src=pr&el=footer). Last update [26b3e7d...3ac9102](https://codecov.io/gh/pandas-dev/pandas/pull/22074?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

pls rebase
> need to narrow down existing issues which it closes.

AFAICT #7830 is the only issue this closes on its own.  BUT after this is done we can make more `DataFrame` ops operate column-wise (orthogonal to #22019 because `DataFrame` ops are a hive of scum and villainy), and _that_ closes a ton of issues.

<b>update</b> That follow-up will be made much less verbose if preceeded by #22068.
> AFAICT #7830 is the only issue this closes on its own. BUT after this is done we can make more DataFrame ops operate column-wise (orthogonal to #22019 because DataFrame ops are a hive of scum and villainy), and that closes a ton of issues.

> update That follow-up will be made much less verbose if preceeded by #22068.

you wnt to merge this first then #22068 ?
This and #22068 should be orthogonal, either order is fine.
tiny comment, not sure if worth changing
> tiny comment, not sure if worth changing

Let's roll that into one of the cleanup-followups.  I'm eager to do the fix-all-the-bugs one that comes after this.
thxs