12345678910 |
- export const dateFormat = (date, format = 'yyyy-MM-dd') => {
- const year = date.getFullYear()
- const month = date.getMonth() + 1
- const day = date.getDate()
- return format.replace('yyyy', year)
- .replace('MM', (month < 10 ? '0' + month : month))
- .replace('dd', (day < 10 ? '0' + day : day))
- }
|