ng2-ui / datetime-picker

Angular2 DateTime Picker
https://ng2-ui.github.io/#/datetime-picker
MIT License
121 stars 62 forks source link

Trailing/leading days disabled for no reason #131

Closed peterdeme closed 7 years ago

peterdeme commented 7 years ago

Hi,

We are having an issue where the trailing and leading days are disabled but they should not be. Our use case: we are dinamically changing the min-date and max-date input like that: min-date: -15days from default-value, max-date: +15days from default value. Now, for example. Let's say the default value is 2017 Feb 02. In this case is February month is open, then Jan 30 and Jan 31 is disabled in the date picker. If I go back to january, these dates are enabled.

I believe the issue is, that we need to call selectable: !isDateDisabled(toDate(day)), method in monthData.leadingDays as well as in case of monthData.trailingDays.

Thank you! Peter

allenhwkim commented 7 years ago

please provide me a plunker example with how to reproduce the error.

peterdeme commented 7 years ago

https://plnkr.co/edit/pyuDFleDjuZyG6clzZdZ?p=preview

if you open the calendar, the januar dates are disabled.

allenhwkim commented 7 years ago

Oh..

You said The trailing and leading days are disabled but they should not be.

But I think, The trailing and leading days are disabled but they SHOULD be.

That's why it's gryed out as the same as disabled dates.

Do you think it should not?

peterdeme commented 7 years ago

Hi Allen, Yeah, you are probably right, it makes sense to leave it disabled. But one thing. What if, you click on the leading/trailing date and it will take you to that specific month? Same approach as here: https://nkalinov.github.io/ng2-datetime/ (if you click on leading January days, it will take you to January)

peterdeme commented 7 years ago

Thank you! Also, do you think trailing & leading days should have cursor: pointer; applied on them?