diff --git a/main/inc/lib/chat.lib.php b/main/inc/lib/chat.lib.php index 0cf0c2711d..58e4d1890e 100644 --- a/main/inc/lib/chat.lib.php +++ b/main/inc/lib/chat.lib.php @@ -52,9 +52,9 @@ class Chat extends Model { foreach ($_SESSION['openChatBoxes'] as $chatbox => $time) { if (!isset($_SESSION['tsChatBoxes'][$chatbox])) { $now = time() - strtotime($time); - $time = date('g:iA M dS', strtotime($time)); - - $message = get_lang('SentAt')." ".$time; + $time = api_convert_and_format_date($time, DATE_TIME_FORMAT_SHORT_TIME_FIRST); + $message = sprintf(get_lang('SentAtX'), $time); + if ($now > 180) { $user_info = api_get_user_info($chatbox, true); $item = array('s' => '2', 'f' => $chatbox, 'm' => $message, 'online' => $user_info['user_is_online'], 'username' => $user_info['complete_name']); diff --git a/main/inc/lib/internationalization.lib.php b/main/inc/lib/internationalization.lib.php index ca8dfb0468..2e952fc25e 100644 --- a/main/inc/lib/internationalization.lib.php +++ b/main/inc/lib/internationalization.lib.php @@ -31,6 +31,9 @@ define('DATE_TIME_FORMAT_LONG', 3); // August 25, 2009 at 03:28 PM define('DATE_FORMAT_NUMBER', 4); // 25.08.09 define('DATE_TIME_FORMAT_LONG_24H', 5); // August 25, 2009 at 15:28 +define('DATE_TIME_FORMAT_SHORT', 6); // Aug 25, 2009 at 03:28 PM +define('DATE_TIME_FORMAT_SHORT_TIME_FIRST', 7); // 03:28 PM, Aug 25 2009 + // Formatting person's name. define('PERSON_NAME_COMMON_CONVENTION', 0); // Formatting a person's name using the pattern as it has been // configured in the internationalization database for every language. @@ -713,6 +716,20 @@ function api_format_date($time, $format = null, $language = null) { $datetype = IntlDateFormatter::FULL; $timetype = IntlDateFormatter::SHORT; } + break; + case DATE_TIME_FORMAT_SHORT: + $date_format = get_lang('dateTimeFormatShort', '', $language); + if (IS_PHP_53 && INTL_INSTALLED) { + $datetype = IntlDateFormatter::FULL; + $timetype = IntlDateFormatter::SHORT; + } + break; + case DATE_TIME_FORMAT_SHORT_TIME_FIRST: + $date_format = get_lang('dateTimeFormatShortTimeFirst', '', $language); + if (IS_PHP_53 && INTL_INSTALLED) { + $datetype = IntlDateFormatter::FULL; + $timetype = IntlDateFormatter::SHORT; + } break; case DATE_TIME_FORMAT_LONG_24H: $date_format = get_lang('dateTimeFormatLong24H', '', $language);