heo 添加最后更新日期,修复归档日期bug

This commit is contained in:
tangly1024.com
2023-07-27 18:32:21 +08:00
parent a43445377e
commit 2a83af39a9
12 changed files with 28 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ 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)
// 如果格式是中文日期,则转为横杆
const format = local.slice(0, 2).toLowerCase() === 'zh'
? res.replace('年', '-').replace('月', '-').replace('日', '')
: res