From a0559cbb24c81e5986f86dd7db32af5e35839098 Mon Sep 17 00:00:00 2001 From: Miguel Medeiros Date: Sat, 31 Jul 2021 19:25:24 -0300 Subject: [PATCH] Fix time until component round for week interval. (#679) * Fix time until component round for week interval. * Add forceFloorOnTimeIntervals parameter. --- .../mempool-blocks/mempool-blocks.component.html | 2 +- .../src/app/components/time-until/time-until.component.ts | 7 ++++--- .../app/components/transaction/transaction.component.html | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/components/mempool-blocks/mempool-blocks.component.html b/frontend/src/app/components/mempool-blocks/mempool-blocks.component.html index 429623a6d..4b90ce65b 100644 --- a/frontend/src/app/components/mempool-blocks/mempool-blocks.component.html +++ b/frontend/src/app/components/mempool-blocks/mempool-blocks.component.html @@ -21,7 +21,7 @@ - + diff --git a/frontend/src/app/components/time-until/time-until.component.ts b/frontend/src/app/components/time-until/time-until.component.ts index 6e836f1b1..9279260fe 100644 --- a/frontend/src/app/components/time-until/time-until.component.ts +++ b/frontend/src/app/components/time-until/time-until.component.ts @@ -15,6 +15,7 @@ export class TimeUntilComponent implements OnInit, OnChanges, OnDestroy { @Input() time: number; @Input() fastRender = false; @Input() fixedRender = false; + @Input() forceFloorOnTimeIntervals: string[]; constructor( private ref: ChangeDetectorRef, @@ -67,10 +68,10 @@ export class TimeUntilComponent implements OnInit, OnChanges, OnDestroy { let counter: number; for (const i in this.intervals) { if (this.intervals.hasOwnProperty(i)) { - if (i === 'minute') { - counter = Math.round(seconds / this.intervals[i]); - } else { + if (this.forceFloorOnTimeIntervals && this.forceFloorOnTimeIntervals.indexOf(i) > -1) { counter = Math.floor(seconds / this.intervals[i]); + } else { + counter = Math.round(seconds / this.intervals[i]); } const dateStrings = dates(counter); if (counter > 0) { diff --git a/frontend/src/app/components/transaction/transaction.component.html b/frontend/src/app/components/transaction/transaction.component.html index 4dbac16bc..88d85fe87 100644 --- a/frontend/src/app/components/transaction/transaction.component.html +++ b/frontend/src/app/components/transaction/transaction.component.html @@ -120,7 +120,7 @@ - +