From f76aa94187cb08fe3a0718ff35201a8301de9ba7 Mon Sep 17 00:00:00 2001 From: rhinobomb Date: Fri, 18 Oct 2019 11:34:21 -0400 Subject: [PATCH] Align calendar to input element instead of group When there is an input group with a prepend (like a field label) the calendar aligns to the prepend, with this small change it will align to the input field instead. I have not done extensive testing so it could be a bad idea, but it seems to work in every situation I throw at it. --- js/bootstrap-datepicker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/bootstrap-datepicker.js b/js/bootstrap-datepicker.js index 9dfcdb0a0..3c73e1352 100644 --- a/js/bootstrap-datepicker.js +++ b/js/bootstrap-datepicker.js @@ -687,7 +687,7 @@ if (itemZIndex !== 'auto' && Number(itemZIndex) !== 0) parentsZindex.push(Number(itemZIndex)); }); var zIndex = Math.max.apply(Math, parentsZindex) + this.o.zIndexOffset; - var offset = this.component ? this.component.parent().offset() : this.element.offset(); + var offset = this.component ? this.component.parent().find('input').offset() : this.element.offset(); var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false); var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false); var left = offset.left - appendOffset.left;