New to Radzen and I’m very impressed. Thanks, team!
For filtering a DataGrid, I need to make sure that datetimes produced by the advanced filter RadzenDatePicker have the UTCDateTimeKind and not Unspecified. This is for PostgreSQL timestamp with timezone compatibility via EF and npgsql. I can convert them in the setter for the DataGridSettings, but it feels a little bit hacky. Anywhere else it’s a non-issue. I didn’t see anything really obvious in the RadzenDatePickerAPI docs, so I’m wondering if anyone has a suggestion.
Actually, my proposed solution doesn’t work. It seems like maybe my problem is somewhere in QueryableExtension.cs. If I’m right, I suppose I should use CustomFilterExpression but I’m feeling pretty lost. Any help appreciated!
Unfortunately, that doesn’t seem to solve the problem. It appears that no matter what DateTimeKind you pass for DataGridColumnSettings.FilterValue, it gets translated into a linq expression as DateTimeKind.Unspecified. This is an issue for me because npgsql refuses to compare a DateTimeKind.Unspecified to a column it knows is atimestamptz , which is probably a good thing overall.
The conversion could be happening in the Dynamic SQL library, I don’t know. We’re early enough in this project that it probably makes sense to just use timestamp instead of timestamptz in the database and avoid confusing automatic conversions of all kinds.
Thanks for your very prompt help! I think this could be a serious problem for postgres users who can’t or won’t change all of their timestamps.
Maybe I haven’t understood your solution (I did try it), but the problem is not that the database values are the wrong kind or have the wrong value. The problem (as far as I can tell) is that the datagrid filter is generating a linq expression to filter database values against a DateTimeKind.Unspecified. I originally thought this had to do with the datepicker, but it doesn’t matter what the datepicker does. It does this whether or not the FilterValue passed for that column in the DataGridSettings is DateTimeKind.Utc . This is only a problem for npgsql because it refuses to turn that linq expression into SQL when the database values are timestamptz (known UTC values). Hopefully that makes sense.
To be clear, my problem is solved by other means and I appreciate your help.