Reputation: 2601
I have the following code snippet,
private static string CreateFilter(JProperty property)
{
if (property?.Value == null)
{
return null;
}
switch (property.Value.Type)
{
case JTokenType.Array:
return CreateFilterForArray(property.Name, (JArray)property.Value);
case JTokenType.Object:
return CreateFilterForObject(property.Name, (JObject)property.Value);
case JTokenType.Date:
Console.WriteLine("date");
return null;
case JTokenType.String:
return CreateFilterForString(property.Name, ((JValue)property.Value).Value);
case JTokenType.Integer:
return CreateFilterForInteger(property.Name, ((JValue)property.Value).Value);
default:
throw new NotSupportedException($"No known way to handle json value with type of {property.Value.Type}");
}
}
When the property.Value
has a value of {05/22/2019}
, instead of matching to
case JTokenType.Date:
it matches to case JTokenType.String:
I guess this is probably because of the format expected for JTokenType.Date
is different than what I'm providing to it.
What is the format expected by JTokenType.Date
?.
Is there any way to match the date format I have, to the JTokenType.Date
?
Upvotes: 0
Views: 1047