Comparing date field in Query does not work for me

I’m using date fields to compare values or ordering objects with no issues. Can you share an example code? Is date object defined?