Easepick - Book over a weekend without the weekend counting as days

Viewed 29

I am trying to use the Easepick (https://easepick.com/) datepicker to create a holiday booking system.

As the working week is Monday to Friday i need to block out Saturdays and Sundays which i have managed to do.

The next issue i am working with is i need people to be able to book over the course of more than 1 week but not go above there holiday allowance so for example if someone has 5 days remaining and wants to book between Wednesday and the following tuesday they should be able to.

var maxdays = 5
            const picker = new easepick.create({
                element: "#datepicker",
                css: [
                    "https://cdn.jsdelivr.net/npm/@easepick/bundle@1.1.6/dist/index.css"
                ],
                zIndex: 10,
                AmpPlugin: {
                    dropdown: {
                        months: true,
                        years: true,
                        minYear: 2021
                    }
                },
                LockPlugin: {
                    maxDays: maxdays,
                    filter(date, picked) {
                        return [0, 6].includes(date.getDay());
                    }
                },
                plugins: [
                    "AmpPlugin",
                    "RangePlugin",
                    "LockPlugin"
                ],
                
            })

This is what i have so far: https://jsfiddle.net/nzLcktv4/

what can i do?

0 Answers
Related