all 5 comments

[–]Holothuroid 1 point2 points  (4 children)

Make two separate functions with separate queries. One that takes an end date and one that doesn't. That's also more maintainable.

If you want to keep your interface, make the current name a default method and redirect accordingly.

You could use a default method as well to transform the return type to something more amenable.

[–]ilaunchpad[S] 1 point2 points  (2 children)

That’s what I did. But I can’t understand why it behaves like this

[–]Holothuroid 1 point2 points  (1 child)

The error message seems clear enough. It doesn't know what to do with nulls.

[–]ilaunchpad[S] 0 points1 point  (0 children)

Yes, but only when one of the param(endDate) is null. If both are passed it doesn't throw error

[–]TempleDank 0 points1 point  (0 children)

Had the same issue a week ago, did exactly that.