Skip to content
Draft
Changes from 1 commit
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
9 changes: 8 additions & 1 deletion arrow/arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,14 @@ def shift(self, check_imaginary: bool = True, **kwargs: Any) -> "Arrow":
relative_kwargs.pop("quarters", 0) * self._MONTHS_PER_QUARTER
)

current = self._datetime + relativedelta(**relative_kwargs)
# current = self._datetime + relativedelta(**relative_kwargs)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind adding unit tests for this?

original_tz = self.tzinfo
if self._datetime.tzinfo is not None:
utc_dt = self._datetime.astimezone(dateutil_tz.UTC)
current = utc_dt + relativedelta(**relative_kwargs)
current = current.astimezone(original_tz)
else:
current = self._datetime + relativedelta(**relative_kwargs)

# If check_imaginary is True, perform the check for imaginary times (DST transitions)
if check_imaginary and not dateutil_tz.datetime_exists(current):
Expand Down
Loading