mirror of https://github.com/statping/statping
Fix heatmap
parent
dab8c6ce83
commit
c5b93bdbb9
|
@ -82,18 +82,16 @@
|
|||
},
|
||||
methods: {
|
||||
async chartHeatmap() {
|
||||
let start = new Date(new Date().getUTCFullYear(), new Date().getUTCMonth()-2, 1);
|
||||
let start = new Date(Date.UTC(new Date().getUTCFullYear(), new Date().getUTCMonth()-2, 1));
|
||||
let monthData = [];
|
||||
let monthNum = start.getUTCMonth()
|
||||
|
||||
for (let i=1; i<=3; i++) {
|
||||
let end = this.lastDayOfMonth(monthNum)
|
||||
|
||||
window.console.log("getting: ",start, end)
|
||||
let end = this.lastDayOfMonth(start)
|
||||
|
||||
const inputdata = await this.heatmapData(start, end)
|
||||
monthData.push(inputdata)
|
||||
start = new Date(start.getUTCFullYear(), start.getUTCMonth()+1, 1);
|
||||
start = new Date(Date.UTC(start.getUTCFullYear(), start.getUTCMonth()+1, 1));
|
||||
monthNum += 1
|
||||
}
|
||||
this.series = monthData.reverse()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Vue from "vue";
|
||||
const { zonedTimeToUtc, utcToZonedTime, startOfToday, lastDayOfMonth, subSeconds, parse, getUnixTime, fromUnixTime, differenceInSeconds, formatDistance } = require('date-fns')
|
||||
const { startOfToday, lastDayOfMonth, subSeconds, getUnixTime, fromUnixTime, differenceInSeconds, formatDistance } = require('date-fns')
|
||||
import formatDistanceToNow from 'date-fns/formatDistanceToNow'
|
||||
import format from 'date-fns/format'
|
||||
import parseISO from 'date-fns/parseISO'
|
||||
|
@ -36,9 +36,6 @@ export default Vue.mixin({
|
|||
ago(t1) {
|
||||
return formatDistanceToNow(parseISO(t1))
|
||||
},
|
||||
daysInMonth(t1) {
|
||||
return lastDayOfMonth(t1)
|
||||
},
|
||||
nowSubtract(seconds) {
|
||||
return subSeconds(new Date(), seconds)
|
||||
},
|
||||
|
@ -155,11 +152,8 @@ export default Vue.mixin({
|
|||
}
|
||||
return Math.floor(val / 1000) + "μs"
|
||||
},
|
||||
lastDayOfMonth(month) {
|
||||
return new Date(Date.UTC(new Date().getUTCFullYear(), month + 1, 0))
|
||||
lastDayOfMonth(date) {
|
||||
return lastDayOfMonth(date)
|
||||
},
|
||||
firstDayOfMonth(month) {
|
||||
return new Date(Date.UTC(new Date().getUTCFullYear(), month, 1)).getUTCDate()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue