implement ensure_localized in datetimelikeArrayMixin
State: closed

This method is used by `TimelikeOps._round`, so needs to be implemented on the array mixin before we can move forward on #24064.

@TomAugspurger this places the method in a different location than you did in #24024 and made a small docstring edit, but otherwise should be compatible.

Labels:
name: Datetime
description: Datetime data dtype
name: Clean

Comments:
Hello @jbrockmendel! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`pandas/core/arrays/datetimelike.py`](https://github.com/jbrockmendel/pandas/blob/4bd6964bcdf19a3a95a70d807257ee9774d16c27/pandas/core/arrays/datetimelike.py) !

 - There are no PEP8 issues in the file [`pandas/core/indexes/datetimelike.py`](https://github.com/jbrockmendel/pandas/blob/4bd6964bcdf19a3a95a70d807257ee9774d16c27/pandas/core/indexes/datetimelike.py) !


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

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

```diff
@@            Coverage Diff             @@
##           master   #24378      +/-   ##
==========================================
+ Coverage   92.29%   92.29%   +<.01%     
==========================================
  Files         162      162              
  Lines       51841    51849       +8     
==========================================
+ Hits        47847    47855       +8     
  Misses       3994     3994
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.7% <100%> (ø)` | :arrow_up: |
| #single | `42.97% <7.14%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24378?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24378/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `96.51% <100%> (+0.06%)` | :arrow_up: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24378/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `97.28% <100%> (-0.01%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24378?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/24378?src=pr&el=footer). Last update [5d134ec...4bd6964](https://codecov.io/gh/pandas-dev/pandas/pull/24378?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

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

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

```diff
@@            Coverage Diff             @@
##           master   #24378      +/-   ##
==========================================
+ Coverage   92.29%   92.29%   +<.01%     
==========================================
  Files         162      162              
  Lines       51841    51849       +8     
==========================================
+ Hits        47847    47855       +8     
  Misses       3994     3994
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.7% <100%> (ø)` | :arrow_up: |
| #single | `42.97% <7.14%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24378?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24378/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `96.51% <100%> (+0.06%)` | :arrow_up: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24378/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `97.28% <100%> (-0.01%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24378?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/24378?src=pr&el=footer). Last update [5d134ec...4bd6964](https://codecov.io/gh/pandas-dev/pandas/pull/24378?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).