nothing wrong.
but i want an ease way to set multi dates that i have on my database.
this code allow me to enter disable only by edit the code.
i want to option to choose / set disabled dates from my manager form.
You don’t need to change the code every time.
Modify the code so it’ll query the database for disabled dates and automatically assign them to the date-picker as disabled dates.
Have an “isDisabled” field in your collection.
Make it Boolean (true if disabled, empty if enabled).
Have another field with the date (hereafter: “date”).
Then query your collection:
import wixData from 'wix-data';
wixData.query("CollectionName")
.eq("isDisabled", true)
.limit(1000)
.find()
.then((res) => {
let items = res.items;
if (items.length > 0) {
let disabledDates =[];
items.forEach(e => {
disabledDates.push(e.date);
})
$w("#datepicker1").disabledDates = disabledDates;
}
})
Hi there! Can I have the exact format that indicates the date in the field you mentioned (Have another field with the date (hereafter: “date”).)? I’m new to this matter. Thank you.