From d987266e1cd215b49ff7c15f81506a56535298ed Mon Sep 17 00:00:00 2001 From: Gabriel Rubinstein Date: Mon, 23 Oct 2023 17:55:13 +0100 Subject: [PATCH] Support ETAs > 100 hours --- lib/format-time.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/format-time.js b/lib/format-time.js index e419c67..6edee4e 100644 --- a/lib/format-time.js +++ b/lib/format-time.js @@ -15,8 +15,12 @@ module.exports = function formatTime(t, options, roundToMultipleOf){ return (options.autopaddingChar + v).slice(-2); } + // > 1d ? + if(t > 3600 * 24) { + return Math.floor(t / 3600 / 24) + 'd' + autopadding(round((t % (3600 * 24)) / 3600)) + 'h'; + // > 1h ? - if (t > 3600) { + } else if (t > 3600) { return autopadding(Math.floor(t / 3600)) + 'h' + autopadding(round((t % 3600) / 60)) + 'm'; // > 60s ?