Patch to allow 12 hour date to display for emails sent today.

dmandell dmandell at gristle.org
Sat Dec 9 00:25:10 CET 2006


Hi again,

I'm an American and prefer to use a 12 hour time display (i.e. 1:05pm) rather than a 24 hour clock (13:05).  Currently Roundcube allows 12 hour time displays for messages older than one day, but for messages received today it still uses the 24 hour display.  The following patch creates a preference for today's date (called date_today) in main.php.inc and then edits main.inc to use it.

Again, if I'm doing this wrong please let me know.

Thanks,

Doug

Index: roundcubemail/config/main.inc.php.dist
===================================================================
--- roundcubemail/config/main.inc.php.dist      (revision 400)
+++ roundcubemail/config/main.inc.php.dist      (working copy)
@@ -107,6 +107,9 @@
 // the default locale setting
 $rcmail_config['locale_string'] = 'en';
 
+// use this format for today's date display  
+$rcmail_config['date_today'] = 'H:i';
+
 // use this format for short date display
 $rcmail_config['date_short'] = 'D H:i';
 
Index: roundcubemail/program/include/main.inc
===================================================================
--- roundcubemail/program/include/main.inc      (revision 400)
+++ roundcubemail/program/include/main.inc      (working copy)
@@ -1687,7 +1687,7 @@
 
   // define date format depending on current time  
   if ($CONFIG['prettydate'] && !$format && $timestamp > $today_limit)
-    return sprintf('%s %s', rcube_label('today'), date('H:i', $timestamp));
+    return sprintf('%s %s', rcube_label('today'), date($CONFIG['date_short'] ? $CONFIG['date_today'] : 'H:i', $timestamp));
   else if ($CONFIG['prettydate'] && !$format && $timestamp > $week_limit)
     $format = $CONFIG['date_short'] ? $CONFIG['date_short'] : 'D H:i';
   else if (!$format)





More information about the Dev mailing list