From 3e0cb2b862474bb85802a0408a424a42bc3846f1 Mon Sep 17 00:00:00 2001 From: Devin Alexander Torres Date: Mon, 28 Jan 2019 00:17:15 -0600 Subject: [PATCH] fix(download-progress): only calculate ETA when seconds is finite number --- app/components/download-progress/component.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/components/download-progress/component.js b/app/components/download-progress/component.js index a802c63f..5ca3d5a7 100644 --- a/app/components/download-progress/component.js +++ b/app/components/download-progress/component.js @@ -97,9 +97,11 @@ export default class DownloadProgressComponent extends Component.extend( updateProgress(value) { const delta = value - this.get('value'); const speed = this.speed(delta); - const remaining = 1 - value; + const remaining = Math.max(0, 1 - value); const seconds = Math.round(remaining / speed); - const eta = moment().add(seconds, 'second').toDate(); + const eta = Number.isFinite(seconds) + ? moment().add(seconds, 'second').toDate() + : null; this.setProperties({ value, eta }); } }