In Craft 2 the date would be converted to a string automatically. You need to do this explicitly in Craft 3. For exampleconvert the DateTime
object via Filter:
now|date('U')
or via function
now.format('U')
This will format the date as a UNIX timestamp which is sufficient for querying. MySQL datetime format will work too: date('Y-m-d H:i:s')
More info can be found in the upgrade documentation.