From 757debaecce2129acc133f04aeea9aa8ed158c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?simonl=C3=BCbker?= <45229647+simonluebker@users.noreply.github.com> Date: Thu, 21 Nov 2024 07:52:24 +0100 Subject: [PATCH] fixes missing DateOnly Type check in if statement (#1803) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Simon Lübker --- Radzen.Blazor/QueryableExtension.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Radzen.Blazor/QueryableExtension.cs b/Radzen.Blazor/QueryableExtension.cs index 06b1ea08905..48e0f0c43dd 100644 --- a/Radzen.Blazor/QueryableExtension.cs +++ b/Radzen.Blazor/QueryableExtension.cs @@ -787,7 +787,8 @@ internal static string GetColumnODataFilter(RadzenDataGridColumn column, o else if (column.FilterPropertyType == typeof(DateTime) || column.FilterPropertyType == typeof(DateTime?) || column.FilterPropertyType == typeof(DateTimeOffset) || - column.FilterPropertyType == typeof(DateTimeOffset?)) + column.FilterPropertyType == typeof(DateTimeOffset?) || + column.FilterPropertyType == typeof(DateOnly?)) { if (columnFilterOperator == FilterOperator.IsNull || columnFilterOperator == FilterOperator.IsNotNull) { @@ -799,7 +800,7 @@ internal static string GetColumnODataFilter(RadzenDataGridColumn column, o } else { - return $"{property} {odataFilterOperator} {DateTime.Parse(value, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.RoundtripKind).ToString("yyyy-MM-ddTHH:mm:ss.fffZ", CultureInfo.InvariantCulture)}"; + return $"{property} {odataFilterOperator} {(column.FilterPropertyType == typeof(DateOnly?) ? value : DateTime.Parse(value, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.RoundtripKind).ToString("yyyy-MM-ddTHH:mm:ss.fffZ", CultureInfo.InvariantCulture))}"; } } else if (column.FilterPropertyType == typeof(Guid) || column.FilterPropertyType == typeof(Guid?))