This commit is contained in:
tangly1024.com
2023-07-10 11:00:29 +08:00
parent 4047162e48
commit df868f3d21
6 changed files with 7 additions and 27 deletions

View File

@@ -9,10 +9,12 @@ 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'
const format = local.slice(0, 2).toLowerCase() === 'zh'
? res.replace('年', '-').replace('月', '-').replace('日', '')
: res
return format
}
export function formatDateFmt (timestamp, fmt) {
const date = new Date(timestamp)
const o = {