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

1K
Views
Moment.JS - Obtener la fecha del número de semana

No veo esto en la documentación de moment.js. Tal vez me lo estoy saltando, pero quiero convertir un número de semana en un año a un formato de fecha.

por ejemplo

 week: number = 13 year: number = 2017 date: date = // get date format for the first day of that week

Estoy usando moment.js, pero no puedo encontrar lo que quiero en la documentación . ¿Es posible hacer esto? Encontré algunas respuestas para javascript simple, pero como ya estoy usando moment.js, pensé que podría haber una manera fácil de hacer esto.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Si es posible:

 var date = moment('2017').add(13, 'weeks');

Tenga en cuenta que moment('2017') devuelve el 1 de enero de 2017.

over 4 years ago · Santiago Trujillo Report

0

Usando startOf('isoweek') obtendrá el primer día de la semana.

 moment('2017').add(13, 'weeks').startOf('week').format('DD MM YYYY'); // "02 04 2017"m, gives you Sunday(last day of the week) moment('2017').add(13, 'weeks').startOf('isoweek').format('DD MM YYYY'); "27 03 2017"// first day of the week ( gives you Monday)
over 4 years ago · Santiago Trujillo Report

0

Otra forma es usar una cadena de formato

 var dateLocale = moment(week + " " + year, "ww gggg"); var dateISO = moment(week + " " + year, "WW GGGG");
over 4 years ago · Santiago Trujillo 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!