From 796fef04a100e777564ef38466fbaa16e89c09d4 Mon Sep 17 00:00:00 2001 From: Liviu Date: Fri, 16 Nov 2018 21:29:42 +0200 Subject: [PATCH] Fix Timer.fmt for short result strings When doing eg. `Timer.fmt('%H', Timer.now())` the resulting string is ` `. --- fs/api_timer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/api_timer.js b/fs/api_timer.js index e324086..a79e6e2 100644 --- a/fs/api_timer.js +++ b/fs/api_timer.js @@ -43,7 +43,7 @@ let Timer = { // ``` fmt: function(fmt, time) { if (!fmt) return 'invalid format'; - let res = 0, t = Math.round(time || Timer.now()), s = ' '; + let res = 0, t = Math.round(time || Timer.now()), s = ' '; while (res === 0) { res = this._f(s, s.length, fmt, t); if (res === -1) return 'invalid time';