[mat-datepicker] proposal: pull request to add option to display a today button in header
See original GitHub issueBug, feature request, or proposal:
Proposal / Feature
What is the expected behavior?
An option exists to enable a button on the date picker header to jump from the current selection to today.
What is the current behavior?
Not supported
What are the steps to reproduce?
N/A
What is the use-case or motivation for changing an existing behavior?
For some use cases of date picker it is handy to be able to quickly jump from the current selection to today.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
N/A
Is there anything else we should know?
I’ve made this change in my local clone of material2 and am using it in my project.
It’s ready to make a pull request, aside from being based on the current release tag rather than tip of master (I’m unable to get master to build currently) - however the changes apply cleanly to tip of master so easy to transplant.
Given that you support custom header components I’m not sure if you would be willing to accept this, and so thought I’d raise this issue to get some guidance.
I could publish this as an independent module, but as far as I can tell I would need to duplicate the entire “mat-calendar-header” component to do this (which would require ongoing maintenance to keep in sync), and would probably be unable to extend the MatDatepickerIntl to include the string for it.
Please see the attached screenshot for what my change currently looks like. Example usage:
<mat-datepicker showTodayButton="true" #startDatePicker></mat-datepicker>
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Yeah I think this is outside the scope of what we want to support. I would be ok with a PR to add
<ng-content>
between the month selector and arrow buttons. Then you could create a wrapper component with a template like:This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.