Skip to content

feat(material/datepicker): Custom Datepicker #29710

@DjSeanza

Description

@DjSeanza

Feature Description

The goal is to create a custom date picker component by extending the Angular Material Datepicker. This component will inherit all the core functionalities and styling of the Angular Material Datepicker while introducing additional features.

The problem here is that if I want to extend datepicker classes i cant create my own datepicker because there is no way to provide and extend MatDatepickerBase.

@Component({
  selector: 'mat-datepicker',
  template: '',
  exportAs: 'matDatepicker',
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None,
  providers: [
    MAT_SINGLE_DATE_SELECTION_MODEL_PROVIDER,
    { provide: MatDatepickerBase, useExisting: MatDatepicker }, // <- this line right here
  ],
  standalone: true,
})
export class MatDatepicker<D> extends MatDatepickerBase<MatDatepickerControl<D>, D | null, D> {} // <- and this extend right here

Use Case

For example I want to create my own datetime picker, but I don't have time to implement all of the datepicker logic on my own. I can just extend all classes and have the logic already there and just add what i need.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureThis issue represents a new feature or feature request rather than a bug or bug fixneeds triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions