fix: utc时间轴不正确问题

This commit is contained in:
Xu Zhimeng 2024-03-14 15:13:14 +08:00
parent f6a7547aff
commit b290785eb4

View File

@ -80,8 +80,8 @@ const initialOption = {
// `
return `
<div>${params.marker}${params.name}</div>
<div>START${dayjs.utc(params.value[4]).format('YYYY-MM-DD HH:mm:ss')}</div>
<div style="white-space: pre"> END${dayjs.utc(params.value[2]).format('YYYY-MM-DD HH:mm:ss')}</div>
<div>START${dayjs(params.value[4]).format('YYYY-MM-DD HH:mm:ss')}</div>
<div style="white-space: pre"> END${dayjs(params.value[2]).format('YYYY-MM-DD HH:mm:ss')}</div>
`
},
},
@ -190,7 +190,7 @@ export default {
let now = dayjs(new Date())
now = now.add(1, 'hour').set('minute', 0).set('second', 0).set('millisecond', 0)
const max = now.valueOf()
const max = dayjs(dayjs.utc(now.valueOf()).format('YYYY-MM-DD HH:mm:ss')).valueOf()
const min = max - this.scaleSettings.cacheTime * 24 * 60 * 60 * 1000
const option = cloneDeep(initialOption)
const { grid, xAxis, yAxis, series, dataZoom } = option
@ -212,7 +212,7 @@ export default {
formatter: (val) => {
// let dateTime = new Date(val)
// return dayjs.utc(dateTime).format('HH:mm\nMM/DD')
return dayjs.utc(val).format('HH:mm\nMM/DD')
return dayjs(val).format('HH:mm\nMM/DD')
},
color: '#ade6ee',
},