Files
noise/public/javascripts/datetime.js
T
admin 3921a889a2 Using and showing always local time
routes/api.js
   - console.log deleted

public/javascripts/global.js
   - made 'params' to const
   - added setNoUTC in main

public/javascripts/showcharts.js
   - added setNiUTC to set global at highcharts

package.json
   - added luxon
     "version": "3.0.4",
     "date": "2023-04-24 18:00 UTC",
2023-05-24 19:45:12 +02:00

45 lines
1.7 KiB
JavaScript

// all date and time functions
import { DateTime } from './luxon.min.js'
// Show date and time (every minute)
export const showDate = (sofort) => {
let d = DateTime.now()
if(sofort || d.second === 0) {
document.querySelector('#h1datum').innerHTML = d.toFormat('yyyy-MM-dd HH:mm')
}
}
/* ToDo:
// Alle Minute die ktuelle Urzeit anzeigen und
// den Plot für Tages - und Wochendaten updaten.
// Alle 'refreshRate' plus 15sec die Grafiken neu zeichnen
// Die Funktion wird alle Sekunde aufgerufen !
//
function showUhrzeit(sofort) {
var d = moment() // akt. Zeit holen
if (sofort || (d.second() == 0)) { // Wenn Minute grade um
$('#h1uhr').html(d.format('HH:mm'));
$('#subtitle').html(d.format('YYYY-MM-DD')); // dann zeit anzeigen
}
if (((d.minute() % refreshRate) == 0) && (d.second() == 15)) { // alle ganzen refreshRate Minuten, 15sec danach
console.log(refreshRate, 'Minuten um, Grafik wird erneuert');
if ((aktsensorid != 'map') && (doUpdate == true)) { // Wenn nicht die Karte, dann
doPlot('oneday',startDay); // Tages- und
doPlot('oneweek',startDay); // Wochenplot erneuern
}
else {
fetchAktualData();
}
}
}
*/
export const formatJSDate = (d) => {
return DateTime.fromJSDate(d).toFormat('yyyy-LL-dd HH:mm:ss')
}
export const formatISODate = (d) => {
return DateTime.fromISO(d).toFormat('yyyy-LL-dd HH:mm:ss')
}