Skip to content

Highlight specific days #2373

Closed Locked Answered by Dimas-sc
Dimas-sc asked this question in Q&A
May 11, 2021 · 3 comments · 2 replies
Discussion options

You must be logged in to vote

Ok, thx, it'd very helpful having this on v6!

At the moment I solved this way:

$("#startDate-front, #endDate-front").on("show.datetimepicker update.datetimepicker", function (e) {
    highlight_holidays(this, holidays);
});

function highlight_holidays(datepicker, holidays) {
    const calendar_days = $('.datepicker-days', $(datepicker)).find(".day").toArray();
    for (var i = 0; i < calendar_days.length; i++) {
        const calendar_day = calendar_days[i].getAttribute("data-day");
        if (holidays.indexOf(calendar_day) > -1) {
            calendar_days [i].classList.add('highlighted')
        }
    }
}

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@moh19814
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Dimas-sc
Comment options

You must be logged in to vote
1 reply
@moh19814
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
3 participants