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

211
Views
Obtener formato de cadena para la fecha según la configuración regional

Estoy tratando de obtener la cadena de formato para fechas como "dd/MM/yyyy" según la configuración regional. Quiero usarlo en un componente de fecha de selección para cambiar el formato predeterminado según el idioma.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Tengo una solución pero me gustaría otras si es posible.

 function getDateFormatPattern(locale: string) { const getPatternForPart = (part: Intl.DateTimeFormatPart) => { switch (part.type) { case 'day': return 'd'.repeat(part.value.length); case 'month': return 'M'.repeat(part.value.length); case 'year': return 'y'.repeat(part.value.length); case 'literal': return part.value; } }; return new Intl.DateTimeFormat(locale).formatToParts(new Date('2022-01-01')) .map(getPatternForPart) .join(''); };
about 4 years ago · Juan Pablo Isaza Report
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!