Ignoring DateTime.Kind?
See original GitHub issueIn 4.76.0, how would I go about configuring CompareLogic to ignore the Kind property of DateTime objects? IgnoreDateTimeOffsetTimezones = true does not work it seems.
Diff string looks like this:
Types [DateTime,DateTime], Item Expected.StartDate != Actual.StartDate, Values (2022-03-28 13:46:00,2022-03-28 13:46:00)
The only differences between the objects is Kind.Utc vs Kind.Unspecified.
I think the Unspecified kind is due to a bug/feature in .Net Core 3 APIs. It only happens when I call the API with Postman using a body containing:
"StartDate": "{{dateTimeNow}}"
… where dateTimeNow is specified in the following way in the pre-request script:
var dateTimeNow = pm.variables.replaceIn("{{$isoTimestamp}}");
I also think the common solution to this problem is to force Kind.Utc onto DateTime objects created from the incoming request body, and I could potentially do that, but I’m not sure at this point what it would do on the API consumer side.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (6 by maintainers)

Top Related StackOverflow Question
Deployed: https://www.nuget.org/packages/CompareNETObjects/4.77.0
Thanks! 🙂