I need to generate a date in 'Thru: 12/20'
format (like credit/debit card expiration date format). What is the best way to generate a date in this format?
new Date().toJSON().slice(0,7).split('-').reverse().join('/')
I am getting the date in mm/yyyy format but cannot get the desired result
Using Moment, you can simply do the following:
You can use
Intl.DateTimeFormat
to generate a date in date name and dd/MM format