diff --git a/js/components/MainWindow/Marquee.js b/js/components/MainWindow/Marquee.js
index adbf5180..4bd510d7 100644
--- a/js/components/MainWindow/Marquee.js
+++ b/js/components/MainWindow/Marquee.js
@@ -25,8 +25,8 @@ export const getBalanceText = balance => {
export const getVolumeText = volume => `Volume: ${volume}%`;
export const getPositionText = (duration, seekToPercent) => {
- const newElapsedStr = getTimeStr(duration * seekToPercent / 100);
- const durationStr = getTimeStr(duration);
+ const newElapsedStr = getTimeStr(duration * seekToPercent / 100, false);
+ const durationStr = getTimeStr(duration, false);
return `Seek to: ${newElapsedStr}/${durationStr} (${seekToPercent}%)`;
};
diff --git a/js/components/PlaylistWindow/__snapshots__/index.test.js.snap b/js/components/PlaylistWindow/__snapshots__/index.test.js.snap
index cae06a92..c8df1c19 100644
--- a/js/components/PlaylistWindow/__snapshots__/index.test.js.snap
+++ b/js/components/PlaylistWindow/__snapshots__/index.test.js.snap
@@ -161,11 +161,6 @@ exports[`PlaylistWindow renders to snapshot 1`] = `
className="playlist-running-time-display draggable"
>
-
- 0
-
@@ -196,11 +191,6 @@ exports[`PlaylistWindow renders to snapshot 1`] = `
>
0
-
- 0
-
diff --git a/js/utils.js b/js/utils.js
index 010d3e12..855843b6 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -10,14 +10,20 @@ export const getTimeObj = time => {
};
};
-export const getTimeStr = time => {
- const timeObj = getTimeObj(time);
+export const getTimeStr = (time, truncate = true) => {
+ const {
+ minutesFirstDigit,
+ minutesSecondDigit,
+ secondsFirstDigit,
+ secondsSecondDigit
+ } = getTimeObj(time);
+
return [
- timeObj.minutesFirstDigit,
- timeObj.minutesSecondDigit,
+ truncate ? minutesFirstDigit || "" : minutesFirstDigit,
+ minutesSecondDigit,
":",
- timeObj.secondsFirstDigit,
- timeObj.secondsSecondDigit
+ secondsFirstDigit,
+ secondsSecondDigit
].join("");
};
diff --git a/js/utils.test.js b/js/utils.test.js
index 98e3e914..c519563e 100644
--- a/js/utils.test.js
+++ b/js/utils.test.js
@@ -34,9 +34,9 @@ describe("getTimeStr", () => {
const expected = "20:34";
expect(actual).toEqual(expected);
});
- it("pads with zeros", () => {
+ it("pads with only one zero", () => {
const actual = getTimeStr(5);
- const expected = "00:05";
+ const expected = "0:05";
expect(actual).toEqual(expected);
});
it("truncates extra minutes", () => {