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: disabledDates prop not working for month #4370

Closed
legarsjules opened this issue May 10, 2023 · 5 comments · Fixed by #4371
Closed

Calendar: disabledDates prop not working for month #4370

legarsjules opened this issue May 10, 2023 · 5 comments · Fixed by #4371
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@legarsjules
Copy link
Contributor

Describe the bug

The prop disabledDates not working for the month view

Reproducer

https://stackblitz.com/edit/vitejs-vite-qmnj9e

PrimeReact version

9.3.1

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. add prop : view="month"
  2. add prop : disabledDates
  3. see the months are not disabled

Expected behavior

If you give the first day of the month in disabledDates, the month should be in disabled state.

@legarsjules legarsjules added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label May 10, 2023
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels May 10, 2023
@melloware melloware added this to the 9.4.0 milestone May 10, 2023
@melloware
Copy link
Member

Thanks for the reproducer and the PR!

@melloware
Copy link
Member

@legarsjules I am pretty sure your fix also fixes this issue which might even be a duplicate of this issue: #4015

Can you verify?

@legarsjules
Copy link
Contributor Author

@melloware Nope, I still reproduced the issue mentioned in #4015.
I opened a new PR for this one (simple fix) #4389

Let me know if it's ok with you

melloware pushed a commit that referenced this issue May 12, 2023
* Fixed #4370, disabledDates broken for month view

* Fix #4015 disabledDays disabled month as well

* Fix #4015 fix code format
@dochan-consultis
Copy link

Prop disabledDates still doesn't work with month (and year) picker.

Affected places are these:

'data-p-disabled': !isSelectable(0, -1, y)

month: ({ isMonthSelected, isSelectable, i, currentYear }) => classNames('p-monthpicker-month', { 'p-highlight': isMonthSelected(i), 'p-disabled': !isSelectable(0, i, currentYear) }),

year: ({ isYearSelected, isSelectable, y }) => classNames('p-yearpicker-year', { 'p-highlight': isYearSelected(y), 'p-disabled': !isSelectable(0, -1, y) }),

@melloware
Copy link
Member

@dochan-consultis feel free to open a new ticket and PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants