Skip to content

Commit

Permalink
Fix issue primefaces#3337
Browse files Browse the repository at this point in the history
Signed-off-by: undermoodzyx <mygmzyx@gmail.com>
  • Loading branch information
undermoodzyx committed Jul 22, 2017
1 parent 5470252 commit 1384fd4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,14 @@ export class Calendar implements AfterViewInit,AfterViewChecked,OnInit,OnDestroy

if(this.currentMonth === 0) {
this.currentMonth = 11;
this.currentYear--;

if (this.yearOptions && this.yearOptions.length >= 1) {
if (--this.currentYear < this.yearOptions[0]) {
this.currentYear = this.yearOptions[0];
}
} else {
this.currentYear--;
}
}
else {
this.currentMonth--;
Expand All @@ -476,7 +483,15 @@ export class Calendar implements AfterViewInit,AfterViewChecked,OnInit,OnDestroy

if(this.currentMonth === 11) {
this.currentMonth = 0;
this.currentYear++;

if (this.yearOptions && this.yearOptions.length >= 1) {
const maxYear =this.yearOptions[this.yearOptions.length - 1];
if (++this.currentYear > maxYear) {
this.currentYear = maxYear;
}
} else {
this.currentYear++;
}
}
else {
this.currentMonth++;
Expand Down

0 comments on commit 1384fd4

Please sign in to comment.