Skip to content

Commit

Permalink
Merge pull request #4 from lv-zheng/fix_time
Browse files Browse the repository at this point in the history
make nginx log date format better
  • Loading branch information
htfy96 authored Sep 22, 2016
2 parents aafa3e0 + b1e5f29 commit 889ddc3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion updatedata.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@
transitionDuration: 300
};
data.nginx.data = data.nginx.data.map(function(val) {
var tzoffset = (new Date()).getTimezoneOffset() * 60000; // offset in milliseconds
var iso = (new Date(val.time * 1000 - tzoffset)).toISOString().slice(0,-1);
var time = iso.slice(0, 10) + " " + iso.slice(11, 19);
return {
"method": val.method,
"path": val.path,
"status": val.status,
"time": new Date(parseInt(val.time) * 1000)
"time": time
};
});
var hotListPie = new psd3.Pie(config);
Expand Down

0 comments on commit 889ddc3

Please sign in to comment.