diff --git a/src/components/ListTable/formatters/DateFormatter.vue b/src/components/ListTable/formatters/DateFormatter.vue index c8a0138ef..8663ef6f7 100644 --- a/src/components/ListTable/formatters/DateFormatter.vue +++ b/src/components/ListTable/formatters/DateFormatter.vue @@ -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') - } } } diff --git a/src/i18n/date.js b/src/i18n/date.js index 6d79b0e38..d836afd15 100644 --- a/src/i18n/date.js +++ b/src/i18n/date.js @@ -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 } } }