summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/libs/daterangepicker.js
blob: dd731eb4ceeea535e56da225267ebc43627d91df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
odoo.define('web.daterangepicker.extensions', function () {
'use strict';

/**
 * Don't allow user to select off days(Dates which are out of current calendar).
 */
var clickDateFunction = daterangepicker.prototype.clickDate;
daterangepicker.prototype.clickDate = function (ev) {
    if (!$(ev.target).hasClass('off')) {
        clickDateFunction.apply(this, arguments);
    }
};

/**
 * Override to open up or down based on top/bottom space in window.
 */
const moveFunction = daterangepicker.prototype.move;
daterangepicker.prototype.move = function () {
    const offset = this.element.offset();
    this.drops = this.container.height() < offset.top ? 'up' : 'down';
    moveFunction.apply(this, arguments);
};

});