Closed zavndw closed 5 months ago
Hi zavndw can you tell how to config the timezone for frontend , I found frontend dumping flow with wrong timerzone.
Hi zavndw can you tell how to config the timezone for frontend , I found frontend dumping flow with wrong timerzone.
Hello. Requires a little frontend revision. Now he takes the timezone from the browser, you need to make this behavior customization. If I understand correctly, then in this place you need to make changes https://github.com/mbolli/nfsen-ng/blob/master/frontend/js/nfsen-ng.js#L672
fixed,THX
what would be your preference: to take the timezone from the server or to specify it in the config? or both?
select the time zone on the web. Default server zone
Got the same problem but didn't quite understand which variable or value I should change.
If I understand correctly, then in this place you need to make changes https://github.com/mbolli/nfsen-ng/blob/master/frontend/js/nfsen-ng.js#L672
Is this the correct method I should edit?
/**
* reads options from api_graph_options, performs a request on the API
* and tries to display the received data in the dygraph.
*/
function updateGraph()
I believe here is where I should edit the position
var
$.each(data.data, function (datetime, series) {
var position = [new Date(datetime * 1000)];
// add all serie values to position array
$.each(series, function (y, val) {
position.push(val);
});
// push position array to dygraph data
if (dygraph_did_zoom !== true) {
dygraph_data.push(position);
} else {
// when zoomed in, insert position array at the start index of replacement data
dygraph_data.splice(index_to_insert, 0, position);
index_to_insert++; // increase index, or data will get inserted backwards
}
});
I changed
var position = [new Date(datetime * 1000)];
to
var position = [new Date((datetime * 1000) - (3 * 60 * 60 * 1000))];
and then /var/www/html/nfsen-ng/backend/cli.php stop | start
. But nothing changed.
Am I missing something here?
I changed var position = [new Date(datetime 1000)]; to var position = [new Date((datetime 1000) - (3 60 60 * 1000))];
Oopsie, the correct should be:
var position = [new Date((datetime * 1000) + (3 * 60 * 60 * 1000))];
since my TZ is UTC-3
Solved.
@FontouraAbreu can you test #90 or apply these changes https://github.com/mbolli/nfsen-ng/pull/90/commits/8334fc9243aeefa0ce27794e997dc0090f343541 to see if the automatic server timezone detection works?
Sure thing! I will start redoing everything from scratch by next week's end and will use the prep-php-82
branch.
Personally, I prefer a '.conf' file to set these kind of things as said in #17. But I'll surely give preference to an updated php
version.
@FontouraAbreu can you test #90 or apply these changes 8334fc9 to see if the automatic server timezone detection works?
Testing this one now, but just to make sure:
This server you talked about, is it the host machine where the application is running or the apache server?
I'm using apache2 so nfsen-ng
should detect the timezone setting I made at
/etc/php/8.2/apache2/php.ini
?
If this is the case for the "server" mentioned, I've already changed it to my current timezone(UTC-3) and restarted the apache and the nfsen-ng service.
Graph date is being displayed correctly:
As my last .nfcap
files are from 13h00. But the graph still tries to fill the remaining utc offset hours. Is this just a visual issue?
I've just noticed the dates are wrong. For some reason its showing that this data is from 2022, not sure why this is happening
My profiles-data directory structure:
root@nfsen-ng:~# tree -d /var/nfdump/profiles-data/live/source/
/var/nfdump/profiles-data/live/source/
└── 2024
└── 02
├── 21
├── 22
├── 23
├── 24
├── 25
└── 26
9 directories
My machine current date:
root@nfsen-ng:~# date
Mon Feb 26 13:28:47 -03 2024
very weird. when using nfdump does it show the correct dates?
@mbolli - yes it does show the correct date
@mbolli any hints on why this might be happening?
@FontouraAbreu are you on v0.3.1?
oops, now I am. It works now:
Thanks
perfect! :)
if the client looks at the server graphs from a different time zone, it is required to set the time shift in the interface