Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

813
Visualizações
How to Show only date icon in native HTML element?

Not sure whether it is possible to show only icon for input type date.

<input type="datetime-local" id="test" name="test">

as highlighted below, I'm trying to show datepicker in my Angular material table row (doing *ngFor)and trigger datetime when click on date icon.

enter image description here

  1. Don't know what is the exact css to remove or hide input border,mm/dd/yyyy --:-- --
  2. Not sure how it will behave if i hide rest of the elements after finding proper css.

Alternate

after search lot, Found this alternate package and implemented, but its look odd in inside app. enter image description here

So decided to go back and use native html element.

Could someone help me how to show only date-time icon ?

or suggest me datetime picker package for Angular?

Thanks to all

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

complementary my comment

Using ngb-datepicker

  <div
    ngbDropdown
    class="form-group"
    placement="bottom-rigth"
    #myDrop="ngbDropdown"
    (openChange)="open($event, dp)"
  >
    <div class="input-group">
      <button
        ngbDropdownToggle
        class="btn btn-outline-secondary calendar"
        type="button"
      ></button>
      <div ngbDropdownMenu>
        <ngb-datepicker
          #dp
          (select)="onDateSelection($event, myDrop)"
          [displayMonths]="2"
          [dayTemplate]="t"
          outsideDays="hidden"
        >
        </ngb-datepicker>
      </div>
    </div>
  </div>

usign material date picker

<button mat-icon-button [matMenuTriggerFor]="appMenu">
  <mat-icon>calendar_today</mat-icon>
</button>
<mat-menu #appMenu="matMenu" class="drop-calendar" >
    <div (click)="$event.stopPropagation()">
        <mat-calendar #calendar (selectedChange)="select($event,calendar)" ></mat-calendar>
    </div>
</mat-menu>
over 4 years ago · Santiago Trujillo Relatório

0

To discover the -webkit properties in Chrome Developer Tools, I entered Settings > Preferences > Elements and then checked "Show user agent shadow DOM". Once this change was made, I selected datetime-local element and drilled down on the underlying div pseudo elements and discovered by adding the following CSS to my page, I was able to show only the calendar icon.

input[type="datetime-local"]::-webkit-inner-spin-button,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    /* display: none;
    -webkit-appearance: none; */
    margin:0;
}
input[type="datetime-local"]::-webkit-datetime-edit {
    display:none;
}

The result is: enter image description here, just the calendar icon is displayed until the user clicks to select a date.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda