Skip to content

Commit 6035c27

Browse files
hsuanxyzvthinkxie
authored andcommitted
fix(module:datepicker): range-picker reposition browser compatibility (#1045)
close #1006
1 parent 776a642 commit 6035c27

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/components/datepicker/nz-rangepicker.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -564,10 +564,11 @@ export class NzRangePickerComponent implements ControlValueAccessor, OnInit {
564564
if (typeof window !== 'undefined' && this._open && this._cdkOverlay && this._cdkOverlay.overlayRef) {
565565
const originElement = this._cdkOverlay.origin.elementRef.nativeElement;
566566
const overlayElement = this._cdkOverlay.overlayRef.overlayElement;
567-
const originX = originElement.getBoundingClientRect().x;
567+
const originX = originElement.getBoundingClientRect().left;
568568
const overlayWidth = overlayElement.getBoundingClientRect().width;
569569
const margin = window.innerWidth - originX - overlayWidth;
570-
this._offsetX = margin > 0 ? 0 : margin - (measureScrollbar() || 15);
570+
const offsetX = margin > 0 ? 0 : margin - (measureScrollbar() || 15);
571+
this._offsetX = Number.isFinite(offsetX) ? offsetX : 0;
571572
this._cdr.detectChanges();
572573
}
573574
}

0 commit comments

Comments
 (0)