This commit is contained in:
tangly1024
2021-09-27 09:33:21 +08:00
parent 22ca7f6d63
commit dfc0f645d4
76 changed files with 3650 additions and 2 deletions

8
lib/formatDate.js Normal file
View File

@@ -0,0 +1,8 @@
export default function formatDate(date, local) {
const d = new Date(date)
const options = { year: 'numeric', month: 'short', day: 'numeric' }
const res = d.toLocaleDateString(local, options)
return local.slice(0, 2).toLowerCase() === 'zh'
? res.replace('年', ' 年 ').replace('月', ' 月 ').replace('日', ' 日')
: res
}