Day two of spending each day working on my project for a few hours, today’s issue comes from me attempting to filter my database shown on a repeater to only show entries from a certain date. For example purposes I just have these dates hardcoded, here is my main attempt,
#fridayShows is the database name, and ‘date’ is the name of the date and time field
$w.onReady(function () {
$w("#fridayShows").setFilter(wixData.filter().contains("date", '2021-04-10T05:00:00.000Z'));
// console.log($w("#fridayShows"));
});
So this Doesn’t work, but then, if I copy the date from the date and time field, and put it into a text field called “dateString” and then run this code below…
$w.onReady(function () {
$w("#fridayShows").setFilter(wixData.filter().contains("dateString", '2021-04-10T05:00:00.000Z'));
// console.log($w("#fridayShows"));
});
This code Does work. But isn’t a real fix because then I just have to find a way to convert all the date and time fields into strings and put them in their own field.
So my MAIN QUESTION is, why for my purposes am I not able to sort by dates when comparing to the actual date, but I am when comparing by a string of the date?
extra:
I’ve also tried this as well…
$w.onReady(function () {
$w("#fridayShows").setFilter(wixData.filter().contains("date", 'Apr 9, 2021'));
// console.log($w("#fridayShows"));
});
Putting in the date the way it is shown in the content manager to try and compare it and that doesn’t work either.
Please offer assistance!