Query using DateTimePicker giving error, but only sometimes

This works when there is a shipment_date chosen in the datetimepicker_shipment_date:

But when there is no shipment_date chosen, it does not work:

What the heck? (i.e. please help)

#sigh

Currently the best workaround that I have is to hide the table when I get an error in the query:
image

And then show a notification to the user: