Skip to content

Commit

Permalink
fix: timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Cifko committed Oct 10, 2023
1 parent ccf36d7 commit 562c8a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ hbs.registerHelper("json", function (obj) {
});

hbs.registerHelper("timestamp", function (timestamp) {
var dateObj = new Date(timestamp.seconds * 1000);
var dateObj = new Date(timestamp * 1000);
const day = dateObj.getUTCDate();
const month = dateObj.getUTCMonth() + 1;
const year = dateObj.getUTCFullYear();
Expand Down
6 changes: 3 additions & 3 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ function getBlockTimes(last100Headers, algo) {
// This happens if there are no blocks for a specific algorithm in last100headers
return blocktimes;
}
let lastBlockTime = parseInt(last100Headers[i].timestamp.seconds);
let lastBlockTime = parseInt(last100Headers[i].timestamp);
i++;
while (i < last100Headers.length && blocktimes.length < 60) {
if (!algo || last100Headers[i].pow.pow_algo === algo) {
blocktimes.push(
(lastBlockTime - parseInt(last100Headers[i].timestamp.seconds)) / 60
(lastBlockTime - parseInt(last100Headers[i].timestamp)) / 60
);
lastBlockTime = parseInt(last100Headers[i].timestamp.seconds);
lastBlockTime = parseInt(last100Headers[i].timestamp);
} else {
blocktimes.push(0);
}
Expand Down

0 comments on commit 562c8a6

Please sign in to comment.