Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

215
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda