summaryrefslogtreecommitdiff
path: root/addons/timer/static/src
diff options
context:
space:
mode:
Diffstat (limited to 'addons/timer/static/src')
-rw-r--r--addons/timer/static/src/js/timer_mixin.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/addons/timer/static/src/js/timer_mixin.js b/addons/timer/static/src/js/timer_mixin.js
index 779d06dbe4a..7a70e81341e 100644
--- a/addons/timer/static/src/js/timer_mixin.js
+++ b/addons/timer/static/src/js/timer_mixin.js
@@ -39,9 +39,9 @@ odoo.define('timer.Timer', function (require) {
timer.addTime(
moment.utc(
- moment.utc(serverTime)
+ Math.abs(moment.utc(serverTime)
.diff(moment.utc(timer_start))
- ).format("HH:mm:ss")
+ )).format("HH:mm:ss")
);
return timer;
@@ -87,7 +87,7 @@ odoo.define('timer.Timer', function (require) {
hour = parseInt(hour);
minute = parseInt(minute);
- second = parseInt(second);
+ second = (second === undefined) ? 0 : parseInt(second);
this.addSeconds(second);
this.addMinutes(minute);
@@ -99,6 +99,10 @@ odoo.define('timer.Timer', function (require) {
return (this.hours * 60 + this.minutes) * 60 / 3600;
}
+ convertToSeconds() {
+ return (this.hours * 60 + this.minutes) * 60 + this.seconds;
+ }
+
toString() {
const time = {
hours: this.display2digits(this.hours),