I am designing a site for my local football team and want to display a feature where only the next available fixtures are presented on the homepage. Does anyone have any ideas on how this could be achieved. I am working with non-technical people so if there was a way for the users to edit a spreadsheet type DB and the feature on the homepage reads from this that would be ideal but I am open to ideas here.
Hi Paul,
A good solution for you is to compare the dates then show only the upcoming events - here is a snippet code that shows how it work :
*** Note that you have a field called dates which contains the dates for that events .**
const options = { // to get a short date Aug,13 2018
day: "numeric",
month: "short",
year: "numeric"
};
let today=new Date();
wixData.query("dates")
.ge("date", today )//query the dates for greater than or equals today's date
.find()
.then( (results) => {
items.forEach((e,i)=>{
console.log(e.date.toLocaleDateString("en-US", options),i);
//this console will show only the upcoming events dates
});
} )
Good Luck,
Mustafa
Thanks Mustafa I will do some testing.
Hi, I’m looking to try and set up something similar for my local rugby club; I’m also wanting to develop a results page as well…did you manage to come up with a working solution to the former, and do you have any suggestions for the latter?