Hi there. I’ve developed a site that show’s an image and some related text each day, changing depending on the date set in the collection. This is done using the code below.
If today’s image is displayed here, it’s boolean value for a field called ‘current’ should be ‘true’, so it is not shown in a separate gallery of ‘Previous Photos’. How can I amend this code to change the ‘current’ field of this image record in the collection to True and the ‘current’ field of all other images in the collection to ‘not true’.
import wixData from 'wix-data';
$w.onReady(function () {
$w("#dataset1").onReady( () => {
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);
$w("#dataset1").setFilter( wixData.filter()
.between('date', dateValue1, dateValue2)
);
});
});