Bug #4863

Incorrect date in agenda

Added by Olivier CORRE over 8 years ago. Updated over 8 years ago.

Bug resolved
Target version:
Start date:
Due date:
% Done:


Estimated time:
Spent time:
SCRUM pts - complexity:


When adding an item in agenda (in either view : week, month, etc.), date is wrong. For instance, you click on saturday 22pm then you insert an item and it is added on saturday 7am.

This on beeznest test platform (8/6/2012).


Associated revisions

Revision 24230de4 (diff)
Added by Julio Montoya over 8 years ago

Should fix bug in agenda when dealing with datetimes with timezones see #4863



Updated by Marko Kastelic over 8 years ago

actually, current date (today's) is used instead of selected / or is it today - 1 day

edit: hm, newest local installations shows : date of inserted item is set to selected date -1 day

edit2 : agenda.ajax.php got correct epoch/utc time. Looks like the problem is caused by recent changes in using utc or timezones ...

edit 3: (agenda.lib.php method add_event() line : 54)
there is double conversion (unfinished task?)

$start         = date('Y-m-d H:i:s', $start);     // old one
$end = date('Y-m-d H:i:s', $end);
$start         = api_get_utc_datetime($start);    // new one
$end = api_get_utc_datetime($end);

using just api_get_utc : visualisation is ok, but database shows 1 day behind. Instead of selected jun 23 00:00 there is jun 22 22:00. (my timezone is gmt+2). Portal timezone (server timezone) is obviusly currently not used to store date/time to the database .


Updated by Yannick Warnier over 8 years ago

  • Target version set to 1.9 RC1

Updated by Julio Montoya over 8 years ago

  • Status changed from New to Needs more info
  • % Done changed from 0 to 80

Hello Marko and Olivier, thanks for your valuable bug description, I just sent a fix


Updated by Marko Kastelic over 8 years ago

tested on chamilodev 14.06.2012/7:30 at approx. 14:30 gmt+2:
- month view (adding all day event): event is set 1 day before
- when trying to add a half an hour event on 21:00 (9PM) the system added event at 1400. look at the time in the previous line... Do not know where the server is located, but there is 7 hour difference ...
there is much more like moving events to the previous day while inserting new one ... i will try to report more detailed in a day or two ...


Updated by Julio Montoya over 8 years ago

I changed a file in javascript (month.tpl) that is managed by Twig (the new template system we use for Chamilo 1.9)

chamilodev in in "production mode" so templates are cached (that's why my changes are not refreshed)
I just set the server in "test mode" (no cache) and also clean the archive/ directory ... new js content should be parsed now


Updated by Marko Kastelic over 8 years ago

looks much better. Works good for me. Let's see what we will hear from Oliver .
btw: template cache is cleared by cleaning archieve folder ?


Updated by Olivier CORRE over 8 years ago

It seems to be corrected now.


Updated by Julio Montoya over 8 years ago

  • Status changed from Needs more info to Bug resolved
  • % Done changed from 80 to 100

feel free to reopen if it doesn't work

Also available in: Atom PDF