Skip to content

Commit

Permalink
Fix for issue 4755
Browse files Browse the repository at this point in the history
A fix for the issue discussed in primefaces#4755. 

A case where the previous code doesn´t work is if minDate currentMonth is January, i.e. 0.
  • Loading branch information
Aask authored Jan 16, 2018
1 parent 6654dbf commit 3ff34fc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export class Calendar implements AfterViewInit,AfterViewChecked,OnInit,OnDestroy

set minDate(date: Date) {
this._minDate = date;
if(this.currentMonth && this.currentYear) {
if(this.currentMonth != undefined && this.currentMonth != null && this.currentYear) {
this.createMonth(this.currentMonth, this.currentYear);
}
}
Expand All @@ -363,7 +363,7 @@ export class Calendar implements AfterViewInit,AfterViewChecked,OnInit,OnDestroy

set maxDate(date: Date) {
this._maxDate = date;
if(this.currentMonth && this.currentYear) {
if(this.currentMonth != undefined && this.currentMonth != null && this.currentYear) {
this.createMonth(this.currentMonth, this.currentYear);
}
}
Expand All @@ -374,7 +374,7 @@ export class Calendar implements AfterViewInit,AfterViewChecked,OnInit,OnDestroy

set disabledDates(disabledDates: Date[]) {
this._disabledDates = disabledDates;
if(this.currentMonth && this.currentYear) {
if(this.currentMonth != undefined && this.currentMonth != null && this.currentYear) {
this.createMonth(this.currentMonth, this.currentYear);
}
}
Expand All @@ -385,7 +385,7 @@ export class Calendar implements AfterViewInit,AfterViewChecked,OnInit,OnDestroy

set disabledDays(disabledDays: number[]) {
this._disabledDays = disabledDays;
if(this.currentMonth && this.currentYear) {
if(this.currentMonth != undefined && this.currentMonth != null && this.currentYear) {
this.createMonth(this.currentMonth, this.currentYear);
}
}
Expand Down

2 comments on commit 3ff34fc

@jbreitenbach
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you going to submit (or have you already submitted) this PR for PrimeNG to review?
I didn't see it in their PR's but I'm new to how they handle the review process.

@Aask
Copy link
Owner Author

@Aask Aask commented on 3ff34fc Jan 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey

I´m new to these processes as well. I thought that a change suggestion might be enough for you guys, seeing as I only changed a couple of rows.

Is it or do you want a PR?

Please sign in to comment.