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

238
Visualizações
input type date getting date from another location

I have an input of type date, on some computers it returns the date in the format dd/MM/yyyy, but in others it returns in the format MM/DD/yyyy, I would like it to return only format dd/MM/yyyy Brazilian pattern

                        <div class="input-group input-group text-center input-cep w-mmd-50 input-date">
                            <input formControlName="data" type="date" min="{{today}}" class="form-control"
                            id="inputData"  >
                       </div>

Would there be a way to do this with just HTML or javascript or an angular pipe? I didn't find anything about it, I searched about it and it says that it changes depending on the locale or browser

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

0

The default value of date you get from input type="date" is in (yyyy-mm-dd) format you need to change that to your requirement. For reference you can check here

function myDateFormat() {

var dateControl = document.querySelector('input[type="date"]');
console.log(dateControl.value);
const [year, month, day] = dateControl.value.split('-');

const result = [day, month, year].join('/');
document.getElementById("showDate").innerHTML = result;

}
#showDate {
margin-top:10px;
}
<input type="date" onchange="myDateFormat()">
<div id="showDate"></div>

about 4 years ago · Juan Pablo Isaza Relatório

0

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date [bold face mine]

Note: The displayed date format will differ from the actual value — the displayed date is formatted based on the locale of the user's browser, but the parsed value is always formatted yyyy-mm-dd.

In other words, you can let browser decide formatting since this will be user dependant for international consumption.

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