Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!