changed date/time to local time

actions/getsensorData.js
   - interpret given date/time as local time and convert ist to UTC for database

databases/influx.js
   - log for 'read' added

utilities/logit.js
   - print time in local time

sensorspecials/noise.js
   - print starttime im options as local time
   - remove 'zone:utc' from every time function
This commit is contained in:
rxf
2023-05-25 09:24:12 +02:00
parent 969a37b8c6
commit 5d10f681ea
4 changed files with 15 additions and 11 deletions
+7 -7
View File
@@ -48,7 +48,7 @@ export const getNoiseData = async (params, possibles, props) => {
sid: opts.sensorid,
indoor: props.location[0].indoor,
span: opts.span,
start: opts.start.slice(7),
start: DateTime.fromISO(opts.start.slice(7)),
data: opts.data,
peak: opts.peak,
count: erg.values.length,
@@ -183,7 +183,7 @@ async function getdavgData(opts) {
count += item.count;
pk += item.peakcount;
if (werte.datetime === undefined) {
let dt = DateTime.fromISO(item.datetime, {zone: 'utc'})
let dt = DateTime.fromISO(item.datetime)
werte.datetime = dt.startOf('day').toISO()
}
}
@@ -211,7 +211,7 @@ async function getdavgData(opts) {
// add the actual date to wert, if werte is undefined
const addDatetime = (werte, item) => {
if (werte.datetime === undefined) {
let dt = DateTime.fromISO(item.datetime, {zone: 'utc'})
let dt = DateTime.fromISO(item.datetime)
werte.datetime = dt.startOf('day').toISO()
}
}
@@ -496,14 +496,14 @@ peak = data
// hour in an element in docs becomes the index into the new array (for every new day this
// index will be incremented by 24). Missing values are marked by: {n_sum=-1, n_AVG=-1}.
// For havg add the missed hours to the arry
const misshours = DateTime.fromISO(ret.values[0].datetime, {zone: 'utc'}).get('hour')
const misshours = DateTime.fromISO(ret.values[0].datetime).get('hour')
let hoursArr = new Array(opts.span * 24 + misshours); // generate new array
hoursArr.fill(emptyValues) // fill array with 'empty' values
let startDay = DateTime.fromISO(ret.values[0].datetime, {zone: 'utc'}).get('day') // calc first day
let startDay = DateTime.fromISO(ret.values[0].datetime).get('day') // calc first day
let k = 0
for (let d of ret.values) { // loop through docs
let stunde = DateTime.fromISO(d.datetime, {zone: 'utc'}).get('hour') // get current hour
let day = DateTime.fromISO(d.datetime, {zone: 'utc'}).get('day') // get current day
let stunde = DateTime.fromISO(d.datetime).get('hour') // get current hour
let day = DateTime.fromISO(d.datetime).get('day') // get current day
if (day != startDay) { // if date has changed
k += 24 // increment index by 24
startDay = day