From c22088adb49e84c14ea7898fd9199e9b18f01356 Mon Sep 17 00:00:00 2001 From: ysnozts Date: Wed, 18 Sep 2024 13:31:21 +0300 Subject: [PATCH] Update for date time fix (#55) * Update ExpressionBuilder.cs * Update DynamicQueryBuilder.csproj --- DynamicQueryBuilder/DynamicQueryBuilder.csproj | 6 +++--- DynamicQueryBuilder/ExpressionBuilder.cs | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DynamicQueryBuilder/DynamicQueryBuilder.csproj b/DynamicQueryBuilder/DynamicQueryBuilder.csproj index acb1ff6..c212734 100644 --- a/DynamicQueryBuilder/DynamicQueryBuilder.csproj +++ b/DynamicQueryBuilder/DynamicQueryBuilder.csproj @@ -15,9 +15,9 @@ false true false - 1.0.5 - 1.0.0.5 - 1.0.0.5 + 1.0.6 + 1.0.0.6 + 1.0.0.6 Enable dataset null search operations diff --git a/DynamicQueryBuilder/ExpressionBuilder.cs b/DynamicQueryBuilder/ExpressionBuilder.cs index 5376eb4..b3fcb5c 100644 --- a/DynamicQueryBuilder/ExpressionBuilder.cs +++ b/DynamicQueryBuilder/ExpressionBuilder.cs @@ -475,6 +475,11 @@ internal static Expression BuildFilterExpression(ParameterExpression param, Filt : null; } + if (convertedValue is DateTime dateTimeValue) + { + convertedValue = DateTime.SpecifyKind(dateTimeValue, DateTimeKind.Utc).ToUniversalTime(); + } + Expression constant = Expression.Constant(convertedValue); switch (filter.Operator) @@ -562,4 +567,4 @@ private static bool AreCountsMatching(string[] operations, string[] parameterNam return new int[] { operations.Length, parameterNames.Length, parameterValues.Length }.Distinct().Count() == 1; } } -} \ No newline at end of file +}