Skip to content

Commit d00cafb

Browse files
authored
Don't block querying over DateOnly/TimeOnly in JSON (#2149)
Though until System.Text.Json supports DateOnly/TimeOnly, converters must be used. Fixes #2148
1 parent ea14ba0 commit d00cafb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/EFCore.PG/Query/ExpressionTranslators/Internal/NpgsqlJsonPocoTranslator.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ private SqlExpression ConvertFromText(SqlExpression expression, Type returnType)
123123
return _sqlExpressionFactory.Convert(expression, returnType, _typeMappingSource.FindMapping(returnType, _model));
124124
}
125125

126-
if (unwrappedReturnType == typeof(Guid) || unwrappedReturnType == typeof(DateTimeOffset))
126+
if (unwrappedReturnType == typeof(Guid)
127+
|| unwrappedReturnType == typeof(DateTimeOffset)
128+
|| unwrappedReturnType == typeof(DateOnly)
129+
|| unwrappedReturnType == typeof(TimeOnly))
127130
{
128131
return _sqlExpressionFactory.Convert(expression, returnType, _typeMappingSource.FindMapping(returnType, _model));
129132
}

0 commit comments

Comments
 (0)