I\'m trying to use JS to turn a date object into a string in YYYYMMDD format. Is there an easier way than concatenating Date.getYear()
date object
YYYYMMDD
Date.getYear()
How about Day.js?
It's only 2KB, and you can also dayjs().format('YYYY-MM-DD').
dayjs().format('YYYY-MM-DD')
https://github.com/iamkun/dayjs