Opened 6 years ago

Closed 6 years ago

#1484288 closed Feature Requests (fixed)

feature to use server's time zone offset and daylight saving time setting

Reported by: bthielsen Owned by:
Priority: 5 Milestone: 0.1-rc2
Component: PHP backend Version: git-master
Severity: trivial Keywords: timezone dst
Cc:

Description

i wanted roundcube to get it's time zone offset and DST setting from the OS - in the interest of having one less place to maintain those settings, so i added the below code to main.in.php. i'm certain it belongs elsewhere and should probably be done differently, but i thought the concept would be worth suggesting.

// custom code to pull dst setting from server
if (date(I) == 1) {
   $cst_dst = 'TRUE';
   } else {
   $cst_dst = 'FALSE';
}

// custom code to pull time zone offset from server
$cst_tz = date(O);
$cst_tz = substr($cst_tz, 0, strlen($cst_tz)-2);
if (date(I) == 1) {
   $cst_tz--;
}

// use this timezone to display date/time
$rcmail_config['timezone'] = "$cst_tz";

// daylight savings are On
$rcmail_config['dst_active'] = "$cst_dst";

Change History (2)

comment:1 Changed 6 years ago by moc

  • Milestone set to 0.1-rc2

I disagree with retriving the time zone offset from the Roundcube server, because it might happen that I'm living in a different country from the server's country. So I have to choose which time zone to use.

The DST setting could be automatic, deriving from the PHP function date('I'). I suggest to change main.inc (line 1721) with the following simple code:

  $tz += date('I');

In this manner I can delete the entry $rcmail_configdst_active? in main.inc.php and simplify the settings form.

comment:2 Changed 6 years ago by thomasb

  • Resolution set to fixed
  • Status changed from new to closed

Added to trunk in [d7d66380]

Transmitting the browser's timezone settings after login would be the most user-friendly solution.

Note: See TracTickets for help on using tickets.