summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/libs/daterangepicker.js
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/web/static/src/js/libs/daterangepicker.js
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/web/static/src/js/libs/daterangepicker.js')
-rw-r--r--addons/web/static/src/js/libs/daterangepicker.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/web/static/src/js/libs/daterangepicker.js b/addons/web/static/src/js/libs/daterangepicker.js
new file mode 100644
index 00000000..dd731eb4
--- /dev/null
+++ b/addons/web/static/src/js/libs/daterangepicker.js
@@ -0,0 +1,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);
+};
+
+});