Skip to content

Commit

Permalink
fixes missing DateOnly Type check in if statement (#1803)
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Lübker <[email protected]>
  • Loading branch information
simonluebker and Simon Lübker authored Nov 21, 2024
1 parent 6d5dda8 commit 757deba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Radzen.Blazor/QueryableExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,8 @@ internal static string GetColumnODataFilter<T>(RadzenDataGridColumn<T> 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)
{
Expand All @@ -799,7 +800,7 @@ internal static string GetColumnODataFilter<T>(RadzenDataGridColumn<T> 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?))
Expand Down

0 comments on commit 757deba

Please sign in to comment.