- Posts: 15
- Thank you received: 5
if ($isSef == '1')
{
?>
<script type="text/javascript">
var d = new Date()
var offset= -d.getTimezoneOffset()/60;
location.href = "<?php echo $this_url; ?>?offset="+offset;
</script>
<?php
}
else
{
?>
<script type="text/javascript">
var d = new Date()
var offset= -d.getTimezoneOffset()/60;
location.href = "<?php echo $this_url; ?>&offset="+offset;
</script>
<?php
}
if (date_default_timezone_get() == 'UTC')
{
$offset = 0; // No need to calculate offset, as default timezone is already UTC
}
else
{
$timezone = new DateTimeZone(date_default_timezone_get()); // Get timezone object
$offsetSecs = $timezone->getOffset(new DateTime('2000-01-01 00:00:00')); // Offset in seconds
$offset = round(abs($offsetSecs)/3600); // Offset in hours
}
JRequest::setVar('offset'. $offset);
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
In addition, I found a few other issues while I had the hood up.
1 The function get_timezone_offset() is embedded within another function. I've never seen that done before. I moved it to be a function of the class and changed the reference to it accordingly.
2 jQuery gets loaded directly rather than using a function call to tell Joomla to load it. That means that two copies get loaded instead of one. The iCagenda copy is an obsolete version which could lead to problems.
3 The jQuery coding doesn't use the recommended compatibility style so any other components using Mootools may conflict.
Please Log in or Create an account to join the conversation.