Skip to content

Commit 16d5686

Browse files
committed
refactor(utils): use padStart to format date string
1 parent 55f780c commit 16d5686

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/@vuepress/shared/src/utils/formatDateString.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ export const formatDateString = (
1515

1616
// fill leading zeros for month and day
1717
const [, yearStr, monthStr, dayStr] = dateMatch
18-
return [yearStr, `0${monthStr}`.slice(-2), `0${dayStr}`.slice(-2)].join('-')
18+
return [yearStr, monthStr.padStart(2, '0'), dayStr.padStart(2, '0')].join('-')
1919
}

0 commit comments

Comments
 (0)