Hi
I have a collection with image, text and date fields. I want to display the image and text on a webpage if today’s date matches the date field. Any suggestions or help is highly appreciated.
Here is the piece of code I am using
$w . onReady ( function () {
let localDate = new Date ();
let yearValue = localDate . getFullYear ();
let monthValue = localDate . getMonth ();
let dayValue = localDate . getDate ();
let dateValue1 = new Date ( yearValue , monthValue , dayValue , 0 , 0 , 0 );
let dateValue2 = new Date ( yearValue , monthValue , dayValue , 23 , 59 , 59 );
wixData . query ( 'Collection1' )
. between ( 'Date' , dateValue1 , dateValue2 )
. find (). then ( results => {
console . log ( results )
$w ( '#image13' ). src = results . items [ 0 ]. image ;
$w ( '#text41' ). text = results . items [ 0 ].text
});
I am getting the following error when running the above code
Cannot read properties of undefined (reading ‘image’)
Is anyone able to work around this error?