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

206
Visualizações
How to use luxon Datetime.fromFormat when time zone is in the date string?

We have run into a bug in our UI using luxon.DateTime. currently the code looks like this:

DateTime.fromFormat(input, "yyyy-MM-dd'T'TT 'GMT'").toFormat(format);

The problem is that this is explicitly looking for GMT time. We also get UTC times and when that happens the code fails to generate a proper time.

I'm trying to figure out the cleanest way to specify the section of the input time that corresponds to 'GMT' or 'UTC' should be treated as a zone.

The best option I could come up with is a regex to pull out the zone from the input string, and then specify it in the options passed to fromFormat, but that seems cumbersome. Surely there is a cleaner solution I'm just too incompetent to find in the luxon API?

...this would be so much easier if the backend just passed us Linux time instead of a random string for a timestamp. Linux time is your friend people, use it!

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