[Update] 修改时间日期i18n

This commit is contained in:
ibuler 2020-05-11 14:20:15 +08:00
parent 1dafaf12aa
commit 60f174fe0e
2 changed files with 17 additions and 11 deletions

View File

@ -9,18 +9,14 @@ export default {
extends: BaseFormatter,
data() {
const dt = new Date(this.cellValue)
// const year = dt.getFullYear()
// const month = dt.getMonth() + 1
// const date = dt.getDate()
// const hour = dt.getHours()
// const minutes = dt.getMinutes()
// const seconds = dt.getSeconds()
const value = this.$d(dt, 'medium')
// const locale = this.$i18n.locale
// const value = dt.toLocaleString(locale, { hourCycle: 'h23' })
// console.log(this.$i18n.locale)
return { value: value }
// return {
// value: `${year}-${month}-${date} ${hour}:${minutes}:${seconds}`
// }
return {
value: this.$d(dt, 'long')
}
}
}
</script>

View File

@ -3,18 +3,28 @@ export default {
short: {
year: 'numeric', month: 'short', day: 'numeric'
},
medium: {
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
hourCycle: 'h23', hour12: false
},
long: {
year: 'numeric', month: 'short', day: 'numeric',
weekday: 'short', hour: 'numeric', minute: 'numeric'
hour: 'numeric', minute: 'numeric'
}
},
'cn': {
short: {
year: 'numeric', month: 'short', day: 'numeric'
},
medium: {
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',
hourCycle: 'h23', hour12: false
},
long: {
year: 'numeric', month: 'short', day: 'numeric',
weekday: 'short', hour: 'numeric', minute: 'numeric', hour12: true
hour: 'numeric', minute: 'numeric', hour12: true
}
}
}