Filter in Excel Export - Wrong Date


I use two datepickers to filter a datagrid and it works as expected - but If I use the same datepickers to filter for the excelexport the date is not the same - it looks like the day and months is swapped

Grid filter date: '2022-01-03T14:27:39.1726740+01:00'
excel export filter date: '2022-03-01T14:27:39.1726740+01:00'

this is send to the server on button click to export die xls:
http://localhost:5000/export/pdb/pfuscherakterhebungs/excel(fileName='MeineErhebungen')?$filter=i => i.Ermittler_ID == 43 && i.Erhebungsdatum >= "03.01.2022 14:42:18" && i.Erhebungsdatum <= "10.01.2022 14:42:18"&$expand=Pfuscherakt,Ermittler&$select=Akt_ID,Pfuscherakt.Aktenzahl,Ermittler.Ermittler1 as Ermittler


Hi @Mad.Rain,

When exporting dates you need to convert them to proper dynamic Linq expression string. Check this article for reference: Date range filter (Blazor)

I've made also small app to illustrate this - Orders created using CRUD Pages from our Sample database with export:

DatePickers are bound to two page properties for start and end date and these properties are used in Filter and Export buttons.

Filter button:

Export button (only for CSV however the same can be applied for Excel):

As you can see there is additional GetDateAsString() method in the expression which is declared in the page partial class:

The result from filter is:

and from export:

You can get the application from here:

1 Like

Thanks - it also works if I add it directly into the filter: