when time get overwritten/updated, we need to set last time, to avoid error that time can not be set before last action

This commit is contained in:
ralf 2022-10-25 20:16:04 +02:00
parent 4c1e2a268e
commit 38e7a977d1

View File

@ -543,11 +543,18 @@ egw.extend('timer', egw.MODULE_GLOBAL, function()
{ {
timer.offset -= action === 'start' ? -change : change; timer.offset -= action === 'start' ? -change : change;
update(); 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 // for a running timer, we need to adjust the (virtual) start too
else if (timer.start) else if (timer.start)
{ {
timer.start = new Date(timer.start.valueOf() - change); 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', egw.request('timesheet.EGroupware\\Timesheet\\Events.ajax_updateTime',
[tse_id, new Date((new Date(_values.time)).valueOf() + egw.getTimezoneOffset() * 60000)]) [tse_id, new Date((new Date(_values.time)).valueOf() + egw.getTimezoneOffset() * 60000)])