Skip to content

fix: skip time truncation for date objects in truncate_datetime#597

Open
SAY-5 wants to merge 1 commit into
qlustered:devfrom
SAY-5:fix/truncate-datetime-date
Open

fix: skip time truncation for date objects in truncate_datetime#597
SAY-5 wants to merge 1 commit into
qlustered:devfrom
SAY-5:fix/truncate-datetime-date

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 24, 2026

Fixes #564.

DeepDiff(..., truncate_datetime=...) raised TypeError: 'second' is an invalid keyword argument for replace() when comparing datetime.date values, because datetime_normalize called replace(second=0, ...) on a plain date that has no time component.

A datetime.date (that is not a datetime.datetime) has no time fields, so time truncation is now skipped for it. datetime and time truncation are unchanged. Added a regression test.

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