Bugfix: Change mempool block time precision. (#650)

* Fix time precision.

* Fix rounding numbers only for minutes range.
Fix reflected avg time to ETA transactions.

* Fix now variable update.
This commit is contained in:
Miguel Medeiros
2021-07-24 19:26:29 -03:00
committed by GitHub
parent 11f5e99187
commit f6a889298c
6 changed files with 43 additions and 9 deletions

View File

@@ -58,16 +58,20 @@ export class TimeUntilComponent implements OnInit, OnChanges, OnDestroy {
}
calculate() {
const seconds = Math.floor((+new Date(this.time) - +new Date()) / 1000);
const seconds = (+new Date(this.time) - +new Date()) / 1000;
if (seconds < 60) {
const dateStrings = dates(1);
return $localize`:@@time-until:In ~${dateStrings.i18nMinute}:DATE:`;
}
let counter;
let counter: number;
for (const i in this.intervals) {
if (this.intervals.hasOwnProperty(i)) {
counter = Math.round(seconds / this.intervals[i]);
if (i === 'minute') {
counter = Math.round(seconds / this.intervals[i]);
} else {
counter = Math.floor(seconds / this.intervals[i]);
}
const dateStrings = dates(counter);
if (counter > 0) {
if (counter === 1) {