From 66d7abf70b375233be027288222ace23aa57802d Mon Sep 17 00:00:00 2001 From: Javier Godoy <11554739+javier-godoy@users.noreply.github.com> Date: Mon, 1 Jul 2024 12:40:42 -0300 Subject: [PATCH] fix: format time when timer starts/stops --- .../resources/META-INF/frontend/simple-timer/simple-timer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/resources/META-INF/frontend/simple-timer/simple-timer.js b/src/main/resources/META-INF/frontend/simple-timer/simple-timer.js index f801941..0e8ae52 100644 --- a/src/main/resources/META-INF/frontend/simple-timer/simple-timer.js +++ b/src/main/resources/META-INF/frontend/simple-timer/simple-timer.js @@ -121,10 +121,8 @@ Polymer({ ready: function() { if (this.countUp) { this.set('currentTime', 0); - this.set('_formattedTime', '0'); } else { this.set('currentTime', this.startTime); - this.set('_formattedTime', this.startTime.toString()); } }, @@ -175,6 +173,9 @@ Polymer({ if (timeString[0].indexOf('-') === 0) { return 0; } + if (timeString.length==1) { + timeString.push("00"); + } var seconds = timeString[0]; var minutes = seconds / 60 | 0; var hours = minutes / 60 | 0;