Search button sorting by date

Hi,

I need to add a search button on my website that allow me to search in my db by date.
I use this code and it works correctly for all other data, but doesn’t work for date.

export function button3_click(event, $w) {
wixData.query(“No_Flusso”)
.contains(“data”, $w(“#datePicker1”).value)
.find()
.then(res => {
$w(“#table1”).rows = res.items;
});


Could you please have a solution?

I think the best way is convert DateTime in string format and then use the code above.

But… Anyone can have the code for convert date in string?

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toDateString