diff --git a/nezha-fronted/src/components/common/js/tools.js b/nezha-fronted/src/components/common/js/tools.js index 7bb95a4c3..9a82bec27 100644 --- a/nezha-fronted/src/components/common/js/tools.js +++ b/nezha-fronted/src/components/common/js/tools.js @@ -289,7 +289,7 @@ export function stringTimeParseToUnix (stringTime) { const localOffset = new Date().getTimezoneOffset() * 60 * 1000 * -1 // 默认 一分钟显示时区偏移的结果 // console.log(offset,localOffset, time) time = time + localOffset - offset * 60 * 60 * 1000 - return time / 1000 + return parseInt(time / 1000) } export function getTime (size, unit) { // 计算时间 const now = new Date(bus.computeTimezone(new Date().getTime())) diff --git a/nezha-fronted/src/components/page/alert/alertMessage.vue b/nezha-fronted/src/components/page/alert/alertMessage.vue index 0c5cfc0df..58169a73d 100644 --- a/nezha-fronted/src/components/page/alert/alertMessage.vue +++ b/nezha-fronted/src/components/page/alert/alertMessage.vue @@ -244,10 +244,8 @@ export default { }, queryChartDate () { const $temp = this - // const start = this.searchTime[0] ? this.searchTime[0] : getTime(-1, 'h') - // const end = this.searchTime[1] ? this.searchTime[1] : getTime(0, 'h') - const start = this.currentMsg.startAt - const end = this.currentMsg.endAt + const start = this.searchTime[0] ? this.searchTime[0] : bus.computeTimezoneTime(new Date().getTime() - 1 * 30 * 60* 1000) + const end = this.searchTime[1] ? this.searchTime[1] : bus.computeTimezoneTime(new Date().getTime()) this.searchTimeDialog = [start, end] const timeDiff = (new Date(end).getTime() - new Date(start).getTime()) / 1000 / (24 * 60 * 60) let step = '15s'