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

181
Visualizações
Angular application has two different locale for debug and run

I have an application with a calendar that posts a string representation of a timestamp. I pick a date, let's assume from a date picker (it's date-fns and angular-calendar).

I have a POST in my service

  postWorkingSlot(workingSlot: NewWorkingSlot, selectedOperativeID: number)
  {
    let util = new Util();
    workingSlot.starting_time = util.formatDateString(workingSlot.starting_time)
    workingSlot.ending_time = util.formatDateString(workingSlot.ending_time)
    const body = JSON.stringify(workingSlot);
    console.log('Timestamp added : ', body);
    return this.http.post((endpoint + "/" + "api/v1/professional/availability_slot/" + selectedOperativeID ), body, this.httpOptions);
  }

and this is a utility function I am using because I realised that formatDate() has some problems with 12/24h representation. The weird thing is that for the same date (lets assume the 2nd of July) when I run in debug mode I am getting : 2022-07-02T09:00:00.000+00:00 and when I run with ng serve I am getting 2022-02-07T09:00:00.000+00:00. You can see this happening in console in the following 2 images : ng serve debug

The failure you can see in the first image is 7th of the 15th month (which of course fails). I suspect a problem in the locale settings but what? What am I missing?

Thanks a lot for your time.

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