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

158
Visualizações
Default Input value for datetime-local

I have a fairly simple date time picker in angular, similar to docs https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local

<input type="datetime-local" value="2017-06-01T08:30">

This works fine if I want a fixed hardcoded date. But I want the default value to be a variable, so i can use current date and time. I tried using value="someVar" where someVar = "2017-06-01T08:30", but the value is not read. So it looks like hardcoded date is working, stored date is not. Suggestions? Thanks!

edit: I can't share the ts code, but I have this for the date var

export class someComp { someVar: string = "2017-06-01T08:30"

etc...

}

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you just need to send the 'someVar' to input, use [value]="someVar".

If you want to have 'someVar' potentially changable by some logic later (in ts) use value="{{someVar}}".

about 4 years ago · Juan Pablo Isaza 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