Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

208
Vistas
Angular mat-date-range-input custom dateInput

I have created a demo here: https://stackblitz.com/edit/angular-ivy-8bvyfh?file=src/app/app.module.ts

I created mat-date-range-input, which works with MomentDateAdapter. When I select days from different months all fine: enter image description here

But if I select days from the same month, it's expected, that month will be omitted. So instead of: enter image description here

I would like to see: "24 - 27 October". How can I achieve it?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Demo in this Stackblitz Link

One work around is you can replace text from input using template reference variable.

  <mat-date-range-input [rangePicker]="picker">
   <input
     #dateRangeStart
      matStartDate
      placeholder="Start date"
      (blur)="dateRangeChange(dateRangeStart, dateRangeEnd)"
      (dateChange)="dateRangeChange(dateRangeStart, dateRangeEnd)"
    />
    <input
      matEndDate
      placeholder="End date"
      #dateRangeEnd
      (dateChange)="dateRangeChange(dateRangeStart, dateRangeEnd)"
    />
  />

and then inside component.ts file you can do like this

  dateRangeChange(s, e) {
    s.value = s.value.split(' ')[0];
  }
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda