fixing whole-day events get one day shorter when editing them in EGroupware (caused by yesterdays whole-day with timezone fix for TB)

This commit is contained in:
ralf 2024-08-02 16:09:15 +02:00
parent 5e12328a4d
commit 7ea6c338d3
2 changed files with 4 additions and 1 deletions

View File

@ -193,6 +193,7 @@ class DateTime extends \DateTime
* Like DateTime::add, but additional allow to use a string run through DateInterval::createFromDateString
*
* @param DateInterval|string $interval eg. '1 day', '-2 weeks'
* @returns DateTime the modified object to allow chaning
*/
public function add($interval) : \DateTime
{

View File

@ -1559,7 +1559,9 @@ class calendar_boupdate extends calendar_bo
}
if (!empty($event['end']))
{
$time = $this->so->startOfDay(new Api\DateTime($event['end'], Api\DateTime::$user_timezone));
// as EGroupware end of whole-day events is 1sec (or sometimes 60sec) shorter, we have to add 60sec,
// before calling startOfDay to NOT lose one day
$time = $this->so->startOfDay((new Api\DateTime($event['end'], Api\DateTime::$user_timezone))->add('60seconds'));
$time->add('-1second');
$event['end'] = Api\DateTime::to($time, 'ts');
$save_event['end'] = $time;