fluentassertions.json icon indicating copy to clipboard operation
fluentassertions.json copied to clipboard

JSON document has a string instead of a date

Open Ynhockey opened this issue 3 years ago • 3 comments

I'm not sure what exactly happens here, but I am comparing two JSON objects with ISO date formats that look like this:

2021-07-20T06:00:00.000Z

The code looks like this:

response.Should().BeEquivalentTo(JObject.Parse(apiResponseContent));

However, while the dates in response are kept, it looks like the dates in apiResponseContent are truncated, and become:

2021-07-20T06:00:00

The test therefore produces an error: JSON document has a string instead of a date at ...

Has anyone encountered this? Is it by design?

Ynhockey avatar Jul 29 '21 20:07 Ynhockey

I'm about to hit the sheets for today, but if you share a complete minimal runnable example I'll try to give it a look tomorrow.

jnyrup avatar Jul 29 '21 20:07 jnyrup

I just ran into this same issue, when comparing two JObjects, did you ever find a solution @Ynhockey ?

evilpilaf avatar Oct 19 '22 08:10 evilpilaf

@evilpilaf can you provide us with a minimal runnable example?

dennisdoomen avatar Dec 12 '22 14:12 dennisdoomen