Skip to content

Commit

Permalink
fix: 日期格式化
Browse files Browse the repository at this point in the history
  • Loading branch information
dongyuanxin committed Oct 18, 2020
1 parent 1a0e89a commit 16b209b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pages/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ export default {
if (!(date instanceof Date)) {
return
}

return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
const year = date.getFullYear() + ''
const month = ((date.getMonth() + 1) + '').padStart(2, '0')
const day = (date.getDate() + '').padStart(2, '0')
return `${year}-${month}-${day}`
},

loadMore() {
Expand Down

0 comments on commit 16b209b

Please sign in to comment.