BUG: fix TypeError for invalid integer dates %Y%m%d with errors='ignore'
State: closed

- [x] closes #26583
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

 array_strptime returned TypeError when trying to slice 'too long' integer for the given format %Y%m%d (for example 2121010101).
    After parsing date in the first 8 symbols it tried to return the remaining symbols in ValueError message as a slice of integer which in turn caused TypeError.
    Converted to string value is now used to make slice for that ValueError message.
    In case of 20209911, it tried to parse 20209911 to datetime(2020, 9, 9) and had 11 left unparsed.


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

Comments:
Hello @nathalier! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:



There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2019-06-01 20:03:56 UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26585?src=pr&el=h1) Report
> Merging [#26585](https://codecov.io/gh/pandas-dev/pandas/pull/26585?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/4c54dd298692783f417cbaa57d5fc1c0dc1f7c72?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #26585      +/-   ##
==========================================
- Coverage   91.84%   91.83%   -0.01%     
==========================================
  Files         174      174              
  Lines       50644    50644              
==========================================
- Hits        46516    46511       -5     
- Misses       4128     4133       +5
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.37% <ø> (ø)` | :arrow_up: |
| #single | `41.69% <ø> (-0.11%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26585?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26585/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26585/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97% <0%> (-0.12%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/26585/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `90.81% <0%> (-0.11%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26585?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/26585?src=pr&el=footer). Last update [4c54dd2...c53b284](https://codecov.io/gh/pandas-dev/pandas/pull/26585?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/26585?src=pr&el=h1) Report
> Merging [#26585](https://codecov.io/gh/pandas-dev/pandas/pull/26585?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/c6a7cc1e08f9203caf57599244cd1c51f6347875?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #26585      +/-   ##
==========================================
- Coverage   91.84%   91.83%   -0.01%     
==========================================
  Files         174      174              
  Lines       50644    50644              
==========================================
- Hits        46515    46511       -4     
- Misses       4129     4133       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.37% <ø> (ø)` | :arrow_up: |
| #single | `41.69% <ø> (-0.09%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26585?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26585/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26585/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97% <0%> (-0.12%)` | :arrow_down: |

------

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

Minor comment, needs a whatsnew, but generally LGTM.
@nathalier you are adding the short digits to an issue? (not this one that is being closed, correct)? if so we can merge this.
Thanks @nathalier !