Pandas version checks

  • [X] I have checked that this issue has not already been reported.

  • [X] I have confirmed this bug exists on the latest version of pandas.

  • [ ] I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd

start = pd.Timestamp("2023-11-05T01:00:00-07:00")
start = start.tz_convert("America/Los_Angeles")
end = start + pd.DateOffset(hours=1)

# Works fine
pd.date_range(start, end, freq='H')

# Also works fine
pd.date_range(start, end, freq='24H')  # 23/25H works too

# Fails: both 'start' and 'end' are DST folds
pd.date_range(start, end, freq='D')

# Fails: 'start' is a DST fold
pd.date_range(start, end + pd.DateOffset(days=1), freq='D')

# Fails: 'end' is a DST fold
pd.date_range(start - pd.DateOffset(days=1), end, freq='D')

# Fails: the calendar day range contains a DST fold (the actually ambiguous case)
pd.date_range(start - pd.DateOffset(days=1), end + pd.DateOffset(days=1), freq='D')

Issue Description

date_range returns an AmbiguousTimeError when its calendar day range contains a DST boundary. It seems to happen whenever the output would contain a DST boundary, even if the inputs are time zone aware in the same time zone.

Expected Behavior

The returned range(s) acknowledge the unambiguous DST folds, e.g.

>>> pd.date_range(start, end, freq='D')  # Both time zone aware DST folds
...  # Just 'start' in the range

Installed Versions

INSTALLED VERSIONS ------------------ commit : 66e3805b8cabe977f40c05259cc3fcf7ead5687d python : 3.7.17.final.0 python-bits : 64 OS : Linux OS-release : 5.10.102.1-microsoft-standard-WSL2 Version : #1 SMP Wed Mar 2 00:30:59 UTC 2022 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : C.UTF-8 LOCALE : en_US.UTF-8 pandas : 1.3.5 numpy : 1.17.3 pytz : 2019.3 dateutil : 2.8.2 pip : 23.3.1 setuptools : 47.1.0 Cython : None pytest : 7.1.1 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : 3.0.9 lxml.etree : 4.4.2 html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : None pandas_datareader: None bs4 : None bottleneck : None fsspec : 2023.1.0 fastparquet : None gcsfs : None matplotlib : 3.5.3 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : 10.0.1 pyxlsb : None s3fs : None scipy : 1.3.1 sqlalchemy : 2.0.6 tables : None tabulate : None xarray : None xlrd : None xlwt : None numba : None