Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar not honoring selectOtherMonths property correctly #1689

Closed
hjalmers opened this issue Dec 27, 2016 · 2 comments
Closed

Calendar not honoring selectOtherMonths property correctly #1689

hjalmers opened this issue Dec 27, 2016 · 2 comments

Comments

@hjalmers
Copy link

hjalmers commented Dec 27, 2016

I'm submitting a ...

[x ] bug report

Current behavior
Even when selectOtherMonths = false month is clickable (but not selectable) and the ui-state-disabled class is applied even if selectOtherMonths = true

Expected behavior
selectOtherMonths = false should disable the ability to click on dates in other months and the class ui-state-disabled should only be applied when this property is false.

Minimal reproduction of the problem with instructions
Use calendar and set selectOtherMonths to false

What is the motivation / use case for changing the behavior?
The function should work as described

  • Angular version: 2.3.1

  • PrimeNG version: 1.1.2

  • Browser: all

hjalmers added a commit to hjalmers/primeng that referenced this issue Dec 27, 2016
external-olgierd added a commit to external-olgierd/primeng that referenced this issue Feb 27, 2017
Applied fix for selectOtherMonths option as it wasnt working properly.
Correct CSS class now applied for dates from other months depending on the value of selectOtherMonths option.
Year calculated properly for date in the next month (but the same year). primefaces#1935
Selectable property set on the date from other month properly based on the value of selectOtherMonths option.
external-olgierd added a commit to external-olgierd/primeng that referenced this issue Feb 27, 2017
Applied fix for selectOtherMonths option as it wasnt working properly.
Correct CSS class now applied for dates from other months depending on the value of selectOtherMonths option.
Year calculated properly for date in the next month (but the same year). primefaces#1935
Selectable property set on the date from other month properly based on the value of selectOtherMonths option.
@external-olgierd
Copy link

external-olgierd commented Feb 27, 2017

Create a pull request with a fix for this issue and also 1689 as they are related.

The first of my commits should be ignored as it was done against incorrect branch/fork.

hjalmers pull request is good and adds good functionality to allow specification of "disabled" dates, but I have created a pull request that fixes only the problem at hand, i.e. that selectOtherMonths option is not working properly - just to minimize the changes and potential impact.

Summary of the changes:

  • applied disabled CSS class for days in other months only if the above option is not set to "true"
  • year for dateMeta object is calculated properly now for next month (previously it was only working for previous months or for next months only in case if the year was also incremented)
  • made sure that "selectable" property of dateMeta is set correctly for dates in other month (i.e. set to false if selectOtherMonths is not set to "true" and set to true otherwise) - this is to make sure other month dates behaves the same as other ones - if they can be selected they act as enabled ones but if they cannot be selected they behave the same as disabled dates (i.e. when click on them calendar doesnt close down)

@cagataycivici
Copy link
Member

I can't replicate with 4.0.RC1, anyone. selectOtherMonths is false by default. Note that, following enables it;

 selectOtherMonths="false"

should be;

 [selectOtherMonths]="false"

Or just leaving it as it is since it is false by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants