From 38e7a977d11730116ac390785d9f873130467a84 Mon Sep 17 00:00:00 2001 From: ralf Date: Tue, 25 Oct 2022 20:16:04 +0200 Subject: [PATCH] when time get overwritten/updated, we need to set last time, to avoid error that time can not be set before last action --- api/js/jsapi/egw_timer.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/js/jsapi/egw_timer.js b/api/js/jsapi/egw_timer.js index 6bc07d8441..24f281b862 100644 --- a/api/js/jsapi/egw_timer.js +++ b/api/js/jsapi/egw_timer.js @@ -543,11 +543,18 @@ egw.extend('timer', egw.MODULE_GLOBAL, function() { timer.offset -= action === 'start' ? -change : change; update(); + // for stop/pause set last time, otherwise we might not able to start again directly after + if (action !== 'start') + { + timer.last = new Date(timer[action]); + } } // for a running timer, we need to adjust the (virtual) start too else if (timer.start) { timer.start = new Date(timer.start.valueOf() - change); + // for running timer set last time, otherwise we might not able to stop directly after + timer.last = new Date(timer.start); } egw.request('timesheet.EGroupware\\Timesheet\\Events.ajax_updateTime', [tse_id, new Date((new Date(_values.time)).valueOf() + egw.getTimezoneOffset() * 60000)])