update time format

This commit is contained in:
liangping 2022-08-26 08:25:09 +08:00
parent 08ed484f54
commit b6dd542cb3
2 changed files with 21 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import { ethToEvmos } from '@tharsis/address-converter'
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import relativeTime from 'dayjs/plugin/relativeTime'
import updateLocale from 'dayjs/plugin/updateLocale'
import utc from 'dayjs/plugin/utc'
import RIPEMD160 from 'ripemd160'
import localeData from 'dayjs/plugin/localeData'
@ -25,7 +26,25 @@ import { EthereumLedgerSigner } from './client/EthereumLedgerSigner.ts'
dayjs.extend(localeData)
dayjs.extend(duration)
dayjs.extend(relativeTime)
dayjs.extend(updateLocale)
dayjs.extend(utc)
dayjs.updateLocale('en', {
relativeTime: {
future: 'in %s',
past: '%s ago',
s: '%ds',
m: '1m',
mm: '%dm',
h: 'an hour',
hh: '%d hours',
d: 'a day',
dd: '%d days',
M: 'a month',
MM: '%d months',
y: 'a year',
yy: '%d years',
},
})
export function getLocalObject(name) {
const text = localStorage.getItem(name)

View File

@ -120,7 +120,7 @@ export default {
],
txFields: [
{ key: 'hash' },
{ key: 'time', formatter: v => toDay(v, 'time') },
{ key: 'time', formatter: v => toDay(v, 'from') },
{ key: 'fee', formatter: v => tokenFormatter(v) },
{ key: 'messages', formatter: v => abbrMessage(v) },
{ key: 'memo' },
@ -162,7 +162,7 @@ export default {
methods: {
length: v => (Array.isArray(v) ? v.length : 0),
shortHash: v => abbr(v),
formatTime: v => toDay(v, 'time'),
formatTime: v => toDay(v, 'from'),
formatProposer(v) {
return getStakingValidatorByHex(this.$http.config.chain_name, v)
},