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

79
Views
¿Cómo generar la fecha en el formato de fecha de vencimiento de la tarjeta de crédito/débito?

Tengo el requisito de generar fechas en este formato 'Thru: 12/20' (como el formato de fecha de vencimiento de la tarjeta de crédito/débito). ¿Cuál es la mejor manera de generar fecha en este formato?

 new Date().toJSON().slice(0,7).split('-').reverse().join('/')

Obtuve la fecha en formato mm/aaaa pero no pude obtener el resultado deseado

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Puede usar Intl.DateTimeFormat para generar la fecha en el nombre del día y el formato dd/MM

 const options = { weekday: 'short', month: 'numeric', day: 'numeric' }; const result = new Intl.DateTimeFormat('en-GB', options).format(new Date()); console.log(result);

over 4 years ago · Santiago Trujillo Report

0

Con Moment puedes simplemente hacer:

 const date = moment().format("ddd DD/MM"); console.log("Valid until : " + date);
 <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>

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!