Skip to content

Commit

Permalink
fix(module:date-picker): window is not defined (#5640)
Browse files Browse the repository at this point in the history
close #5630
  • Loading branch information
emondora authored Aug 3, 2020
1 parent 201ef52 commit f5899ad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/date-picker/picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
HorizontalConnectionPos,
VerticalConnectionPos
} from '@angular/cdk/overlay';
import { Platform } from '@angular/cdk/platform';
import { DOCUMENT } from '@angular/common';
import {
AfterViewInit,
Expand Down Expand Up @@ -238,6 +239,7 @@ export class NzPickerComponent implements OnInit, AfterViewInit, OnChanges, OnDe
private elementRef: ElementRef,
private dateHelper: DateHelperService,
private changeDetector: ChangeDetectorRef,
private platform: Platform,
public datePickerService: DatePickerService,
@Inject(DOCUMENT) doc: NzSafeAny
) {
Expand All @@ -260,7 +262,7 @@ export class NzPickerComponent implements OnInit, AfterViewInit, OnChanges, OnDe
this.focus();
}

if (this.isRange) {
if (this.isRange && this.platform.isBrowser) {
fromEvent(window, 'resize')
.pipe(takeUntil(this.destroy$))
.subscribe(() => {
Expand Down

0 comments on commit f5899ad

Please sign in to comment.