getNextMonthAndYear return undefined as year when month is < 11
I'm submitting a ... (check one with "x")
[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Plunkr Case (Bug Reports) Please fork the plunkr below and create a case demonstrating your bug report. Issues without a plunkr have much less possibility to be reviewed.
http://plnkr.co/edit/mbikgiRs6oWPT8PvMJ24?p=preview
Current behavior
Calendar function getNextMonthAndYear return undefined year when month is less than 11 so when we use selectOtherMonths combined with showOtherMonths we get an invalid date Expected behavior
The function should return the passed param year when month is less than 11 Minimal reproduction of the problem with instructions
` @ViewChild('calendar) calendar: Calendar;
//ngOnInt lifecycle hook
ngOnInt(){
let nextMY = this.calendar.getNextMonthAndYear(1,2017)
console.log('next month is '+nextMY.month + ' next year is '+nextMY.year)
//print: next month is 2 next year is undefined
} ` What is the motivation / use case for changing the behavior?
get the right next year Please tell us about your environment:
OS: OSX 10.12 , IDE : webstorm, package manager: npm
- Angular version: 2.0.X
- PrimeNG version: cloned from github
- Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
-
Language: [all | TypeScript X.X | ES6/7 | ES5]
-
Node (for AoT issues):
node --version=
Created pull-request for this as part of fix for 1689.
Unable to replicate with 4.1.RC2, please provide a test case based on plunkr below and we'll review again.
http://plnkr.co/edit/Wj39h1?p=preview