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

151
Views
Cómo usar FormatJS para formatear la fecha y la hora de la misma manera que en Intl.DateTimeFormat

En mi aplicación de reacción, utilicé javascript Intl.DateTimeFormat() para formatear la fecha y la hora de la manera que necesito. Enlace a este Intl.DateTimeFormat()

Me gustaría mover la misma fecha y hora formateadas a la FormatJS Intl library .

Traté de entender la documentación, pero no tengo idea de cómo lograr lo mismo que se hizo con Intl.DateTimeFormat() .

Este es un ejemplo de un método

 const ZoneDateTime = ({ dateTime, timeZone }) => { let locale; if (timeZone.includes('Europe')) locale = 'en-SE'; if (timeZone.includes('America')) locale = 'en-US'; if (timeZone.includes('Etc')) locale = 'en-EN'; if (timeZone.includes('Europe/London')) locale = 'en-GB'; const formatter = Intl.DateTimeFormat(locale, { timeZone, year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', }); return formatter.format(dateTime) + ` (${timeZone})`; };

Prácticamente el resultado de esto dependiendo de que zona horaria tengamos es un ejemplo

 19 Aug 2021, 02:00 (Europe/Stockholm)

Entonces, mi pregunta es cómo reproducir lo mismo usando la biblioteca FormatJs e IntlShape para mostrar la misma fecha y hora.

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!