question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[mat-datepicker] proposal: pull request to add option to display a today button in header

See original GitHub issue

Bug, 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>

screenshot from 2018-09-20 10-37-18

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
mmalerbacommented, Sep 20, 2018

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:

<mat-calendar-header>
  <button>TODAY</button>
</mat-calendar-header>
0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add close button to customized mat-datepicker-header
I want to add close button the custom header but it seems not possible yet. At least I would like to get output...
Read more >
Mat Datepicker Now Button - StackBlitz
Datepicker with custom calendar header.
Read more >
MatBlazor: Material Design components for Blazor and ... - Gitee
For client-side and server-side Blazor - add script section to index.html or ... MatSortHeaderRow - New component; Fix: MatDatePicker always display's ...
Read more >
@angular/material | Yarn - Package Manager
Important: This documentation covers modern versions of Yarn. For 1.x docs, see classic.yarnpkg.com. Yarn.
Read more >
agGrid for Angular (The Missing Manual) - CodeProject
So, right now, you can see an agGrid in action - you add drag columns to reorder them, click on a header to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found