Closed (fixed)
Project:
Chatroom
Version:
7.x-2.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Jul 2011 at 14:06 UTC
Updated:
9 Mar 2013 at 02:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Yasl commentedDrupal 7 variable_get('date_default_timezone', 0) returns string name and not an offset in seconds. Ugh.
It's showing UTC instead of local time I believe.
I used info from http://forum.civicrm.org/index.php?topic=20462.0
and I just hardwired my offset into the module.
function chatroom_get_user_timezone_offset() {
global $user;
$offset = variable_get('date_default_timezone', 0);
$offset = -25200; // -7(offset) * 60 * 60
if (variable_get('configurable_timezones', TRUE) && isset($user->timezone)) {
$offset = $user->timezone;
}
return $offset;
}
Now to get the day to show as many of our chats are over the course of days.
ok...changed the return in the chatroom_get_message_time_string function to:
return $date->format(variable_get('chatroom_msg_date_format', 'M:d:h:i:s:a'));
using this link to figure out - http://php.net/manual/en/function.date.php
All is well. :)
Comment #2
Aonoa commentedThank you!
I just changed the date format slightly in variation with yours.. 'M-d H:i:s:a'. :-)
Best regards,
Ao
Comment #3
torrance123 commentedI've attached a patch against the latest commit in 7.x-1.x which is a general solution to this problem.
See below for the new function:
Comment #4
michlis commentedSolution provided by @torrance123 fixes time offset problem in 7.x-2.0.
Comment #5
Anonymous (not verified) commentedthanks! committed and pushed.