By mandoju on Thursday, 15 October 2015
Replies 1
Likes 0
Views 1K
Votes 0
Hi,
I was using jevents and i noticed that there was a problem with DST in a comparation , making non-DST dates vs DST dates events not appear, because it's not having the right "if condition" anwser (by 1 hour). i made a modification in components/com_jevents/libraries/jicaleventcalrepeat.php
and it started to work again.

 function eventOnDate($testDate, $multidayTreatment = 0)
{

if (!isset($this->_startday))
{
$this->_startday = JevDate::mktime(0, 0, 0, $this->mup(), $this->dup(), $this->yup());
$this->_startday_plus1 = JevDate::mktime(0, 0, 0, $this->mup(), $this->dup()+1, $this->yup());
$this->_endday = JevDate::mktime(0, 0, 0, $this->mdn(), $this->ddn(), $this->ydn());
// if ends on midnight then testing day should ignore the second day since no one wants this event to show
if ($this->hdn() + $this->mindn() + $this->sdn() == 0 && $this->_startday != $this->_endday)
{
$this->_endday = JevDate::mktime(0, 0, 0, $this->mdn(), $this->ddn()-1, $this->ydn());
}

//check both DST
$atual = $testDate;
$atual_localtime = localtime($atual,true);
$atual_horario_verao = $atual_localtime['tm_isdst'];
$date_localtime = localtime($this->_startday,true);
$date_horario_verao = $date_localtime['tm_isdst'];
//correct the hours
if($atual_horario_verao && !$date_horario_verao)
{
$this->_startday -= 3600;
$this->_endday -= 3600;
}
else if(!$atual_horario_verao && $date_horario_verao)
{
$this->_startday += 3600;
$this->_endday += 3600;
}



}
if ($this->_startday <= $testDate && $this->_endday >= $testDate)
{
// if only show on first day
if ($multidayTreatment == 2 && $testDate >= $this->_startday_plus1)
{
return false;
}
// don't show multiday suppressed events after the first day if multiday is not true
if ($multidayTreatment == 0)
{
if (!$this->_multiday && $testDate >= $this->_startday_plus1)
{
return false;
}
}
return true;
}
else
return false;

}
what timezone settings do you have within JEvents config and also what version of JEvents and Joomla do you have?
·
Friday, 16 October 2015 15:58
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post