Query based on Today Date

Hi guy,

I have a collection named “AttendDB”.
One of the field names is “starttime”, with field type of ‘date and time’.
I want to do a query based on today date but failed.

I have prepared the following code.
Can anyone give me a suggestion? Million thanks

Import wixData from ‘wix-data’;
$w.onReady( function () {

// Gets today’s date
const today = new Date();
const Jtoday = new Date(today);
Jtoday.setDate(today.getDate() - 0);

let queryAttend = wixData.query(“AttendDB”)
.eq(“starttime”, Jtoday.getDate())
.descending(“name”)
.find()
.then((res) => {
console.log(res.items)
})
. catch ((err) => {
let errorMsg = err;
});

})

I know that it is related to
.eq(“starttime”, Jtoday.getDate()). Please help

Hi,

.eq does not accept a Date type as a parameter.
For your case, use .gt instead.