Dear Radzen Support,
we are experiencing an issue with how DateTime values are handled in server-side filters when using Radzen with a Blazor Server application.
We are using a filter like this in our service call:
Filter = "i => i.BuchungDatum == @0 && i.BuchungArt == @1 && i.BuchungBetrag == @2 && i.BuchungId != @3 && i.BuchungBilanz == @4",
FilterParameters = new object[] { i.BuchungDatum, i.BuchungArt, -1 * i.BuchungBetrag, i.BuchungId, bilanzCode }
At runtime, i.BuchungDatum holds a local DateTime value, e.g., 2025-05-01 00:00:01. However, the generated SQL query uses 2025-05-01 02:00:01 instead, which corresponds to the UTC equivalent of the original timestamp (we are in a UTC+2 timezone at this date).
This automatic conversion leads to incorrect results, as the filter fails to match existing records in the database, which store the value exactly as 2025-05-01 00:00:01.
We have tried explicitly setting the DateTimeKind to Unspecified or Local, and also converting to UTC manually, but the behavior persists. The only workaround that consistently works is manually subtracting 2 hours from the timestamp before passing it to the filter – which is obviously not a clean or reliable solution.
We assume this issue is caused by the way Radzen handles parameter serialization and/or EF Core interprets DateTime values internally.
Could you please advise:
Is there a way to prevent Radzen or EF Core from converting local DateTime values to UTC in generated queries?
Would using DateTimeOffset instead of DateTime resolve this issue in your framework?
Is there any recommended approach to avoid this unintended time shift?
We would greatly appreciate any guidance or clarification.
Best regards,