Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeepDiff Fails to Detect Timezone Changes in Arrays with ignore_order=True #517

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

3schwartz
Copy link

@3schwartz 3schwartz commented Jan 9, 2025

Solution proposal for issue #516

Description

The deepdiff library is unable to detect timezone changes in datetimes within arrays.

When ignore_order=True and a datetime is present within an array, deepdiff uses an execution path that makes a DeepHash. Due to the implementation of datetime_normalize, all datetimes have their timezone set to UTC:

obj = obj.replace(tzinfo=datetime.timezone.utc)

This behavior causes issues in our use case, as we rely on deepdiff to detect changes in datetime objects, including changes to their timezones.

Changes

Indent logic which replaces timezone to only affect those which has set truncate_datetime.

Notes

Existing logic was added in commits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant