Skip to content

Commit

Permalink
fix: terms query datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
AElfBourneShi committed Oct 19, 2024
1 parent 04e5814 commit f5d445e
Showing 1 changed file with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,6 @@ private Node GetDifferentTypesTermsQueryNode()
{
query = GetTermsNode<double?>();
}
else if (PropertyType == typeof(DateTime))
{
query = GetTermsNode<DateTime>();
}
else if (PropertyType == typeof(DateTime?))
{
query = GetTermsNode<DateTime?>();
}
else if (PropertyType == typeof(bool))
{
query = GetTermsNode<bool>();
Expand All @@ -379,6 +371,16 @@ private Node GetDifferentTypesTermsQueryNode()
{
query = GetTermsNode<bool?>();
}
else if (PropertyType == typeof(DateTime))
{
query = new TermsNode(PropertyName,
((IEnumerable<DateTime>)Value).Select(x => x.ToString("o")));
}
else if (PropertyType == typeof(DateTime?))
{
query = new TermsNode(PropertyName,
((IEnumerable<DateTime>)Value).Select(x => x.ToString("o")));
}
else if (PropertyType == typeof(string))
{
query = new TermsNode(PropertyName, (IEnumerable<string>)Value);
Expand Down

0 comments on commit f5d445e

Please sign in to comment.