I am trying to pull shipping records that have a certain ship date. Right now, the company does not ship anything on Fridays, Saturdays or Sundays. So I am trying to use a query that will skip over those days. Here is what I was trying to use:
SELECT *
FROM shipping
WHERE ship_date = {{ moment(new Date()).add(2, 'days').format("ddd") = 'FRI' ? moment(new Date()).add(6, 'days') : moment(new Date()).add(2, 'days') }}
GROUP BY id, dealer
ORDER BY ship_date
I am getting the error message "ReferenceError: cannot assign to function call". Dates are something that I always struggle with so if anyone could assist me, I would appreciate it.
One gotcha that has gotten me on using this method is accidentally having my date field stored as text instead of date in my table which led to this function failing. If you got that set as it should be then it should be all good!