Skip to content

Commit

Permalink
Bug 14084 Fix incorrect time for FB data in certain cases.
Browse files Browse the repository at this point in the history
When local browser timezone is different than server's configured
timezone, fb data would be offset incorrectly. Sending
JSON date strings in place of timestamps fixes the issue.
  • Loading branch information
mrubinsk committed Sep 2, 2015
1 parent 8a3fbc1 commit 4de3efc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 2 additions & 3 deletions kronolith/js/kronolith.js
Expand Up @@ -6474,9 +6474,8 @@ KronolithCore = {
div = new Element('div').setStyle({ position: 'relative', height: td.offsetHeight + 'px' });
td.insert(div);
$H(fb.b).each(function(busy) {
var from = new Date(), to = new Date(), left;
from.setTime(busy.key * 1000);
to.setTime(busy.value * 1000);
var left, from = Date.parse(busy.key).addSeconds(1),
to = Date.parse(busy.value).addSeconds(1);
if (!end.isAfter(from) || to.isBefore(start)) {
return;
}
Expand Down
8 changes: 7 additions & 1 deletion kronolith/lib/FreeBusy.php
Expand Up @@ -282,7 +282,13 @@ public static function toJson(Horde_Icalendar_Vfreebusy $fb)
if (empty($b)) {
$b = new StdClass();
}
$json->b = $b;
$new = new StdClass();
foreach ($b as $from => $to) {
$from = new Horde_Date($from);
$to = new Horde_Date($to);
$new->{$from->toJson()} = $to->toJson();
}
$json->b = $new;
return $json;
}

Expand Down

0 comments on commit 4de3efc

Please sign in to comment.