-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
bug(mat-datepicker): Restrict MatCalendarView #24915
Comments
Hello @angelaki , I think we have instructions for what you are trying to accomplish in Datepicker emulating a Year and month picker Could you please take a look at the above documentation and let us know if the datepicker meets your needs? Thanks, |
Hey @zarend in this example you can still toggle to |
Interesting, I'm not able to toggle to How are you able to do that? What steps did you take? Environment
|
Thanks for reporting; I can reproduce. This looks to me like an issue with the example, rather than the date-picker itself. I should be able to look into fixing the example later. |
Actually I don't know what should keep the picker from allowing it. It has an initial view and catches the month selected event. I guess that use-case just isn't supported (yet)? |
Just saw you also responded to my issue #24914. Guess it's pretty related. |
Well, clicking on the period button is supposed to change the view present, but not select anything. The calendar doesn't know that it's not supposed to show the month view in this case. I don't see any quick fix to fix this example. A work-around for this is to use a custom calendar header. I will follow up with this, but it seems like the built-in header is not designed for being used as a month-year picker, or a year picker. For now, a work-around is customizing the calendar header. That would be creating a header that handles switching between year and multi-year view, but doesn't switch to month view. @crisbeto and @mmalerba, do you have context on the intended direction for the month-year picker example? This seems to be more of a limitation of specifically the header to me. |
Hello, so I'm triaging this as a bug. The fix here is to provide a custom header. The header would need
A good place to start is looking at the customizing the calendar header example. We welcome contributions if you are interested :). |
I'd give it a try. Where to start running the components locally? Forked / cloned https://github.com/angular/components, what's next? |
You should be able to run our dev app with |
+1 for this feature.
The example is a bid awkward. When you click on a month, first the view is changed, then the picker is closed. This causes a flash into the month view before closing. Related issue: #20904 |
add missing encapsulation to disable pointer-events for periodButtonLabel. fixes angular#24915
add missing encapsulation to disable pointer-events for periodButtonLabel. fixes #24915
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Feature Description
I'd like to be able to disable some MatCalendarView options.
Use Case
I'm using the picker as a month picker. When changing the view the user get irritated by being able to select a day since the picker usualy closes on month selection (via
(monthSelected)
).The text was updated successfully, but these errors were encountered: