I am attempting to use the following query:
SELECT *
FROM shipping
WHERE CASE
WHEN {{ time.value }} = 'day'
THEN ({{ !date79.value }} OR ship_date = {{ date79.value }})
WHEN {{ time.value }} = 'week'
THEN ship_date BETWEEN {{ moment(new Date()).startOf('day') }} AND {{ moment(new Date()).add(7, 'days').endOf('day') }}
WHEN {{ time.value }} = 'month'
THEN EXTRACT(MONTH FROM shipped::date) = {{ select62.value }}
END;
I have been working on it all morning, but I keep getting the error message "cannot cast type boolean to date".
If someone can tell me what is wrong with my SQL statement I would really appreciate it.