Skip to content

Commit

Permalink
Merge pull request #111 from ltb-project/110-display-localized-time
Browse files Browse the repository at this point in the history
add an option for defining the timezone (#110)
  • Loading branch information
coudot committed Jan 22, 2024
2 parents dd394f9 + 69cdc70 commit 950161c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions conf/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
# Language
$lang ="en";
$date_specifiers = "%Y-%m-%d %H:%M:%S (%Z)";
$date_timezone = "UTC";

# Graphics
$logo = "images/ltb-logo.png";
Expand Down
12 changes: 12 additions & 0 deletions docs/general-parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Set default language in ``$lang``:
Dates
-----

Format
^^^^^^

You can adapt how dates are displayed with specifiers (see `strftime reference`_):

.. _strftime reference: https://www.php.net/strftime
Expand All @@ -77,6 +80,15 @@ You can adapt how dates are displayed with specifiers (see `strftime reference`_
$date_specifiers = "%Y-%m-%d %H:%M:%S (%Z)";
Timezone
^^^^^^^^

You can adapt the default timezone for displaying all the dates (see the `complete list of timezones <https://www.php.net/manual/en/timezones.php>`_):

.. code-block:: php
$date_timezone = "UTC";
Graphics
--------

Expand Down
6 changes: 6 additions & 0 deletions htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@
$smarty->registerPlugin("function", "convert_bytes", "convert_bytes");
$smarty->registerPlugin("function", "split_value", "split_value");

# Set default timezone
if( isset($date_timezone) && !empty($date_timezone) )
{
date_default_timezone_set($date_timezone);
}

#==============================================================================
# Audit
#==============================================================================
Expand Down

0 comments on commit 950161c

Please sign in to comment.