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

226
Visualizações
vue.js not displaying date in input

I'm using vue.js v2. From my api I get an object with some date fields in ISO format but vue.js is not correctly displaying those value in an input tag.

<input type="date" class="form-control" v-model="lastPortalInvoiceDate">

Value found via the vue debug extension in Edge

"2022-02-06T23:00:00Z"

Value returned in JSON from api

{
    "data": {
        "portalInvoiceNumberPrefix": "I-{{BY}}-",
        "portalInvoiceFilePrefix": "ABC",
        "lastPortalInvoiceNumber": 1,
        "lastPortalInvoiceDate": "2022-02-06T23:00:00Z",
        "nextBookYearSwitchDate": "2022-02-10T23:00:00Z",
        "id": 1,
        "value": 1
    },
    "tenantId": 1,
    "responseType": "ok",
    "responseMessages": [
        "Successfully read PortalInvoiceConfig"
    ]
}

enter image description here

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

0

Select a date with datepicker and see the changes in your data. You will see the output in format 'yyyy-mm-dd'. You must format your date. For this, you can split your time string to parse date only.

yourDateStr = yourDateStr.split('T')[0]; //if your date is "2022-02-06T23:00:00Z" format

Parsing with new Date(yourDateStr) will cause you trouble setting the right time zone. So, if you want a simple solution you could do just parse the date.

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