Fixe GMT bug in graph
This commit is contained in:
parent
62c2f4dc35
commit
049734f8a3
|
|
@ -8,6 +8,11 @@ import (
|
||||||
|
|
||||||
"html/template"
|
"html/template"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
_, timezoneOffset = time.Now().Zone()
|
||||||
)
|
)
|
||||||
|
|
||||||
type ViewTempController struct {
|
type ViewTempController struct {
|
||||||
|
|
@ -49,7 +54,7 @@ func formatDataSensor(sensorName string, values []temperature.TempTable) string
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
ret += ","
|
ret += ","
|
||||||
}
|
}
|
||||||
horodate := strconv.FormatInt(values[i].HorodateGMT.Unix() * 1000, 10)
|
horodate := strconv.FormatInt((values[i].HorodateGMT.Unix()+int64(timezoneOffset)) * 1000, 10)
|
||||||
value := strconv.FormatInt(values[i].Value, 10)
|
value := strconv.FormatInt(values[i].Value, 10)
|
||||||
ret += "["+horodate+","+value+"]"
|
ret += "["+horodate+","+value+"]"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,7 @@
|
||||||
});
|
});
|
||||||
Highcharts.setOptions({
|
Highcharts.setOptions({
|
||||||
global: {
|
global: {
|
||||||
useUTC: true,
|
useUTC: false
|
||||||
timezoneOffset: -4 * 60
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue