Incorrect datetime value

My form has a Date component and I am trying to update a MySQL date field using the following query:

UPDATE projects SET
proceedDate = IFNULL(NULLIF(proceedDate, ''), {{ proceedDate.value }})
WHERE ID = {{ projectTable.selectedRow.ID}};

but I am getting the following message:
message:"Incorrect date value: '' for column 'proceedDate' at row 1"

Default value: {{ new Date() }}
Format: MMM d, yyyy

I have tried using different default values and Forms but can't seem to get that value updated.

What is the format in the database?

Type date which looks like 2023-08-31

Use moment to format the date in your statement
moment(your date field.value).format(‘YYYY-MM-DD’)

Thanks for your reply.

I updated my SQL Update statement:

UPDATE projects SET
proceedDate = IFNULL(NULLIF(proceedDate, ''), {{ moment(date_proceedDate.value).format( 'YYYY-MM-DD')}})
WHERE ID = {{ projectTable.selectedRow.ID}};

Still generates the message "Incorrect date value: '' for column 'proceedDate' at row 1"

date_proceedDate.value = "2023-08-29T16:18:14.575-0400"
moment(date_proceedDate.value).format( 'YYYY-MM-DD') = "2023-08-29"

Thanks for the input Scott but I was able to get this done by using the GUI Mode instead of SQL Mode.

2 Likes