agendav icon indicating copy to clipboard operation
agendav copied to clipboard

Issue while fetching events (Baikal server)

Open rsertelon opened this issue 3 years ago • 4 comments

Hi, I'm stumbling upon the following error when upgrading from 2.2.0 to 2.4.0 (I didn't try 2.3.0, for lack of time, sorry):

[2021-05-01 16:11:44] agendav.CRITICAL: Received unexpected exception InvalidArgumentException (/hab/svc/agendav/data/web/src/DateHelper.php:47): Error building DateTimeImmutable object {"input":"[object] (Symfony\\Component\\HttpFoundation\\ParameterBag: {})"} []

I'm at a loss as to why it happens.

rsertelon avatar May 09 '21 15:05 rsertelon

I don't know exactly why this is happening but the issue seems to be that the conversion of pure dates to datetimes behaves sometimes unexpectedly. While the DateHelper function fullcalendarToDateTime expects a pure date (no T...) it sometimes gets the date followed by T00:00:00 and then throws the error. A workaround for this issue would be to adapt the fullCalendarToDateTime function in web/src/DateHelper.php as follows:

87c87,88
<         $input .= 'T000000';
---
>         //was: $input .= 'T000000';
>         $input = str_replace('T00:00:00','',$input).'T000000';

The real cause seems to be somewhere on the js side although I am not sure where that could happen. I am running two agendav-2.4.0 instances in the same browser on virtually the same hardware and same software (same baikal version, same php version; could not find relevant differences in php.ini or installed modules), and one instance shows the discussed behavior while the other does not.

codecivil avatar May 25 '21 16:05 codecivil

I don't know if this will help, but we noticed that the problem occurs after changing Default view to Week in the configuration, if Default view is set to Month, the data is displayed correctly.

piotrekfilip avatar Jun 09 '21 11:06 piotrekfilip

@codecivil Thanks, your patch works perfectly!

rsertelon avatar Sep 09 '21 10:09 rsertelon

Hello,

Same problem today, after changing Default view to Week. Fixed with the patch above, thanks @codecivil !!

bastien30 avatar Oct 05 '21 09:10 bastien30