Hi Guys
I have a database to which admin submits selected dates. I then want to use these dates to disable the dates on my client-facing datePicker. Simple enough, but I can't get it to work..
I have simplified the script down to the following to see if I can find the problem, but I get no errors when running it, and it still doesn't work. Any advice?..
$w.onReady(function () {
$w('#datesDataset').onReady(() => {
wixData.query("DisabledDates")
.find()
.then((date1) => {
let firstItem = new Date(date1.items[0]);
$w("#datePicker1").disabledDates = firstItem.array;
});
});
});
Solution:
Just some context - Admin staff selects a date from the datePicker in the admin page that posts this selected date to a date field called 'date1' in the database(DisabledDates). The script below reads this date, converts it to the right format, and posts this date to the datePicker on the client-facing page, disabling the the date on client-facing datePicker
$w.onReady(function () { $w("#datesDataset").onReady(() => { wixData.query("DisabledDates") .isEmpty('title') .find() .then((date1) => { let firstItem = (date1.items[0]); let badDate1 = new Date(firstItem.date1.toISOString().slice(0,10)); $w("#datePicker1").disabledDates = [badDate1]; }); }); });