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

170
Visualizações
Issue with C# Web API 2 Date format in JSON

I am working on a large system that is using C# Web API 2 and Angular 12 on the front-end. Dates that are coming in via Oracle to C# are true dates in both systems (not strings).

They come across in the format "2021-11-10T10:48:38", which is showing typeof() as string into Angular even though we have these in TypeScript as Date in the interface.

When any JS date operations are attempted on these date objects, they fail, although the front-end compiler doesn't catch them because it assumes they are Date types due to the interface. So it fails at run-time.

What is the best way to handle this on the C# side? I can do ourDate = new Date(ourDate) on the Angular side, which does work, but is not reasonable to do this everywhere we call the API.

I apologize for all the tags but I'm not sure where I should attack this from, I assume in the JSON serialization step on the server.

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