bendavis78 / paper-date-picker

Material design date picker component for polymer
http://bendavis78.github.io/paper-date-picker/
MIT License
225 stars 132 forks source link

When specifying maxDate as a value which is in next year than the current selection the navigation for date doesn't work #133

Closed lahsivjar closed 7 years ago

lahsivjar commented 8 years ago

I found a bug when specifying a maxDate as a value which is in next year than the current selection for example: <paper-date-picker date="September 09, 2016" min-date="September 09, 2016" max-date="March 12, 2017"></paper-date-picker>

In such case nothing happens when you try to navigate to another year. The problem comes from line number: https://github.com/bendavis78/paper-date-picker/blame/master/paper-calendar.html#L526

The reason is that the if condition in this line is not correct. Adding another OR should solve the issue:

if (!this.maxDate || this.currentYear < this.maxDate.getFullYear() || this.currentMonth < this.maxDate.getMonth() + 1) {

lahsivjar commented 8 years ago

FYI, I failed to generate the issue in plunker (http://plnkr.co/edit/9c787GHiBzX7zI5x6gsX) since the code used there seems to be old and doesn't have the problem.

julie2013 commented 8 years ago

I met the same problem, and your code can fix this problem.

Mipme commented 7 years ago

thx for the fix, works perfectly (paper-date-picker 1.2.0)