mirror of
https://github.com/mempool/mempool.git
synced 2025-03-13 19:37:47 +01:00
Update balance widget 7d/30d intervals
This commit is contained in:
parent
2fa33b749c
commit
d7b0923000
1 changed files with 3 additions and 2 deletions
|
@ -57,8 +57,9 @@ export class BalanceWidgetComponent implements OnInit, OnChanges {
|
||||||
calculateStats(summary: AddressTxSummary[]): void {
|
calculateStats(summary: AddressTxSummary[]): void {
|
||||||
let weekTotal = 0;
|
let weekTotal = 0;
|
||||||
let monthTotal = 0;
|
let monthTotal = 0;
|
||||||
const weekAgo = (Date.now() / 1000) - (60 * 60 * 24 * 7);
|
|
||||||
const monthAgo = (Date.now() / 1000) - (60 * 60 * 24 * 30);
|
const weekAgo = (new Date(new Date().setHours(0, 0, 0, 0) - (7 * 24 * 60 * 60 * 1000)).getTime()) / 1000;
|
||||||
|
const monthAgo = (new Date(new Date().setHours(0, 0, 0, 0) - (30 * 24 * 60 * 60 * 1000)).getTime()) / 1000;
|
||||||
for (let i = 0; i < summary.length && summary[i].time >= monthAgo; i++) {
|
for (let i = 0; i < summary.length && summary[i].time >= monthAgo; i++) {
|
||||||
monthTotal += summary[i].value;
|
monthTotal += summary[i].value;
|
||||||
if (summary[i].time >= weekAgo) {
|
if (summary[i].time >= weekAgo) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue