The team's year, a row a person. Drag a vacation to another week or person, stretch it from either end, or double-click a day to add one - nobody can be away twice at once. The month names stay in view as the year scrolls.

Days off are counted on weekdays, against an allowance of 25.
PersonDays offAllowance used

jQuery Scheduler: Vacation Planner (Timeline Year)

A team's vacations for the year on jqxScheduler's timeline year view: a row a person, a column a day under a header a month. Drag a vacation to another week or person, stretch it, or double-click a day to add one; nobody has two vacations at once, and the days off add up per person against their allowance.

A live JavaScript/jQuery example of jqxScheduler, the jQWidgets Scheduler component, with its complete source code below. It is one of 45 jqxScheduler demos for jQuery.

jqxScheduler API used in this demo

Source code

To run it in your own page, load jqx.base.css, a theme and the library files below from npm (npm install jqwidgets-scripts) or the jsDelivr CDN, then add the markup and the script. jQuery is not required: jqxcore.js provides $. Getting started with jqxScheduler shows the setup step by step.

The page loads jqx.base.css, a theme and these library files: jqxcore.js, jqxbuttons.js, jqxscrollbar.js, jqxdata.js, jqxdate.js, jqxscheduler.js, jqxscheduler.api.js, jqxdatetimeinput.js, jqxmenu.js, jqxcalendar.js, jqxtooltip.js, jqxwindow.js, jqxcheckbox.js, jqxlistbox.js, jqxdropdownlist.js, jqxnumberinput.js, jqxradiobutton.js, jqxinput.js.

It also loads helper scripts of this demo site, which are not part of the library: demos.js (getWidth() and other layout helpers).

script.js

$(document).ready(function () {
    // Five people, 25 days of allowance each. A vacation is an all-day appointment of its person.
    var people = ['Alex Morgan', 'Bea Novak', 'Chris Diaz', 'Dana Lee', 'Eli Brooks'];
    var allowance = 25;
    var span = function (person, fromMonth, fromDay, toMonth, toDay, subject) {
        return { subject: subject || 'Vacation', person: person, start: new Date(2026, fromMonth - 1, fromDay), end: new Date(2026, toMonth - 1, toDay, 23, 59) };
    };
    var vacations = [
        span(people[0], 2, 16, 2, 20, 'Ski trip'), span(people[0], 7, 13, 7, 31, 'Summer'), span(people[0], 12, 21, 12, 24),
        span(people[1], 4, 6, 4, 10), span(people[1], 8, 3, 8, 21, 'Summer'), span(people[1], 10, 26, 10, 30),
        span(people[2], 1, 26, 1, 30), span(people[2], 6, 15, 6, 26, 'Summer'), span(people[2], 9, 21, 9, 25), span(people[2], 11, 23, 11, 27),
        span(people[3], 3, 30, 4, 3), span(people[3], 7, 20, 8, 7, 'Summer'), span(people[3], 12, 14, 12, 23, 'Winter'),
        span(people[4], 5, 25, 5, 29), span(people[4], 8, 17, 9, 4, 'Summer'), span(people[4], 11, 2, 11, 6), span(people[4], 12, 28, 12, 31)
    ];
    $.each(vacations, function (i) { this.id = 'v' + i; });

    var source = {
        dataType: 'array',
        dataFields: [
            { name: 'id', type: 'string' },
            { name: 'subject', type: 'string' },
            { name: 'person', type: 'string' },
            { name: 'start', type: 'date' },
            { name: 'end', type: 'date' }
        ],
        id: 'id',
        localData: vacations
    };
    var peopleSource = { dataType: 'array', dataFields: [{ name: 'person', type: 'string' }], localData: $.map(people, function (p) { return { person: p }; }) };

    $('#scheduler').jqxScheduler({
        date: new $.jqx.date(2026, 7, 1),
        width: '100%',
        height: 420,
        rowsHeight: 44,
        source: new $.jqx.dataAdapter(source),
        view: 'timelineYearView',
        // Monday first, as the weekends then fall at the end of each week
        localization: { firstDay: 1 },
        resources: { colorScheme: 'scheme02', dataField: 'person', orientation: 'vertical', source: new $.jqx.dataAdapter(peopleSource) },
        appointmentDataFields: { from: 'start', to: 'end', id: 'id', subject: 'subject', resourceId: 'person' },
        views: [{ type: 'timelineYearView', timeSlotWidth: 30 }, 'monthView', 'yearView'],
        // nobody is away twice at once
        allowOverlap: false
    });

    var status = function (ok, text) {
        $('#status').removeClass('ok no').addClass(ok ? 'ok' : 'no').text(text);
    };
    $('#scheduler').on('appointmentAdding appointmentChanging', function (event) {
        if (event.args.cancel && event.args.reason) {
            status(false, event.args.reason.message + '.');
        }
    });
    $('#scheduler').on('appointmentChange', function (event) {
        var a = event.args.appointment;
        status(true, a.resourceId + ': ' + a.subject + ', ' + a.from.toDate().toDateString() + ' - ' + a.to.toDate().toDateString() + '.');
    });

    // ---- days off per person: the weekdays a vacation covers ----
    var weekdays = function (from, to) {
        var count = 0;
        for (var d = new Date(from.getFullYear(), from.getMonth(), from.getDate()); d < to; d.setDate(d.getDate() + 1)) {
            if (d.getDay() !== 0 && d.getDay() !== 6) count++;
        }
        return count;
    };
    var renderDays = function () {
        var days = {};
        $.each(people, function () { days[this] = 0; });
        $.each($('#scheduler').jqxScheduler('getAppointments'), function () {
            if (days[this.resourceId] !== undefined) {
                days[this.resourceId] += weekdays(this.from.toDate(), this.to.toDate());
            }
        });
        $('#days tbody').empty().append($.map(people, function (person) {
            var used = days[person], over = used > allowance;
            return $('<tr></tr>').toggleClass('over', over)
                .append($('<td></td>').text(person))
                .append($('<td class="num"></td>').text(used + ' of ' + allowance))
                .append($('<td></td>').append($('<div class="bar"></div>').css('width', Math.min(100, used / allowance * 100) + '%')))
                .append($('<td class="note"></td>').text(over ? (used - allowance) + ' over' : ''));
        }));
    };
    $('#scheduler').on('appointmentAdd appointmentChange appointmentDelete', renderDays);
    renderDays();
});

body.html

<div id="content" class="demo">
    
    <p class="demo-intro">
        The team's year, a row a person. Drag a vacation to another week or person, stretch it from either end, or double-click a day to add one - nobody can be away twice at once. The month names stay in view as the year scrolls.
    </p>
    <div id="scheduler"></div>
    <div id="status" class="demo-status" role="status" aria-live="polite">Days off are counted on weekdays, against an allowance of 25.</div>
    <table id="days" class="demo-days">
        <thead><tr><th>Person</th><th>Days off</th><th style="width: 50%">Allowance used</th><th></th></tr></thead>
        <tbody></tbody>
    </table>
</div>

Learn more

More jQuery Scheduler demos