🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Round song duration (instead of truncating it). Relates to #1926
Deluanaf5c2b5a42ed
diff --git a/ui/src/utils/formatters.js b/ui/src/utils/formatters.jsindex 3474f5cb7..f7c658e40 100644--- a/ui/src/utils/formatters.js+++ b/ui/src/utils/formatters.js@@ -14,7 +14,7 @@ export const formatDuration = (d) => {const days = Math.floor(d / 86400)const hours = Math.floor(d / 3600) % 24const minutes = Math.floor(d / 60) % 60- const seconds = Math.floor(d % 60)+ const seconds = Math.round(d % 60)const f = [hours, minutes, seconds].map((v) => v.toString()).map((v) => (v.length !== 2 ? '0' + v : v))diff --git a/ui/src/utils/formatters.test.js b/ui/src/utils/formatters.test.jsindex 6b6163d7d..c4102fb92 100644--- a/ui/src/utils/formatters.test.js+++ b/ui/src/utils/formatters.test.js@@ -19,7 +19,7 @@ describe('formatDuration', () => {it('formats seconds', () => {expect(formatDuration(0)).toEqual('00:00')expect(formatDuration(59)).toEqual('00:59')- expect(formatDuration(59.99)).toEqual('00:59')+ expect(formatDuration(59.99)).toEqual('00:60')})it('formats days, hours and minutes', () => {