Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions arrow/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,9 @@ def utcfromtimestamp(cls, timestamp: Union[int, float, str]) -> "Arrow":
)

@classmethod
def fromdatetime(cls, dt: dt_datetime, tzinfo: Optional[TZ_EXPR] = None) -> "Arrow":
def fromdatetime(
cls, dt: Union["Arrow", dt_datetime], tzinfo: Optional[TZ_EXPR] = None
) -> "Arrow":
"""Constructs an :class:`Arrow <arrow.arrow.Arrow>` object from a ``datetime`` and
optional replacement timezone.

Expand All @@ -318,6 +320,10 @@ def fromdatetime(cls, dt: dt_datetime, tzinfo: Optional[TZ_EXPR] = None) -> "Arr
>>> arrow.Arrow.fromdatetime(dt)
<Arrow [2021-04-07T13:48:00-07:00]>

**NOTE**:
Although you can pass a :class:`Arrow <arrow.arrow.Arrow>`, doing so is not recommended
except for some cases where it simplifies handling both.

"""

if tzinfo is None:
Expand Down Expand Up @@ -635,8 +641,8 @@ def ceil(self, frame: _T_FRAMES) -> "Arrow":
def span_range(
cls,
frame: _T_FRAMES,
start: dt_datetime,
end: dt_datetime,
start: Union["Arrow", dt_datetime],
end: Union["Arrow", dt_datetime],
tz: Optional[TZ_EXPR] = None,
limit: Optional[int] = None,
bounds: _BOUNDS = "[)",
Expand All @@ -646,8 +652,8 @@ def span_range(
representing a series of timespans between two inputs.

:param frame: The timeframe. Can be any ``datetime`` property (day, hour, minute...).
:param start: A datetime expression, the start of the range.
:param end: (optional) A datetime expression, the end of the range.
:param start: A datetime or :class:`Arrow <arrow.arrow.Arrow>` expression, the start of the range.
:param end: (optional) A datetime or :class:`Arrow <arrow.arrow.Arrow>` expression, the end of the range.
:param tz: (optional) A :ref:`timezone expression <tz-expr>`. Defaults to
``start``'s timezone, or UTC if ``start`` is naive.
:param limit: (optional) A maximum number of tuples to return.
Expand Down