aboutsummaryrefslogtreecommitdiffstats
path: root/include/account.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-03-18 14:55:01 +0100
committerMario <mario@mariovavti.com>2021-03-18 14:55:01 +0100
commit3ba42d3dcf252cd2c07f2f1b9c0b7d54cce759c9 (patch)
tree36358bdc3b8d408e8444743d71459c9d397c4d0b /include/account.php
parent9f26b7aa9c6e3ba50de5a0780c917cabad7367f6 (diff)
downloadvolse-hubzilla-3ba42d3dcf252cd2c07f2f1b9c0b7d54cce759c9.tar.gz
volse-hubzilla-3ba42d3dcf252cd2c07f2f1b9c0b7d54cce759c9.tar.bz2
volse-hubzilla-3ba42d3dcf252cd2c07f2f1b9c0b7d54cce759c9.zip
air: deal with timezones when displaying open/close time - this should finally fix issue #1544
Diffstat (limited to 'include/account.php')
-rw-r--r--include/account.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/include/account.php b/include/account.php
index a6067a802..c3c7d26b7 100644
--- a/include/account.php
+++ b/include/account.php
@@ -1238,18 +1238,23 @@ function zar_register_dutystate( $now=NULL, $day=NULL ) {
$dutyis = $isduty ? t('open') : t('closed');
$atform = $isduty ? '' : 'disabled';
+ $utc_now = datetime_convert(date_default_timezone_get(), 'UTC', $now, 'c');
$nowfmt = t('Registration is currently')
- . ' ('.substr($now,0,2) . ':' . substr($now,-2) . ') '
- . ' ' . $dutyis;
+ . ' (<span data-utc="' . $utc_now . '" class="register_date">' . $utc_now . '</span>) '
+ . $dutyis . '.<br>';
+
if (!$isduty) {
$pernext = zarIsDuty($day, $now, 'nextOpen');
+ $week_days = ['','monday','tuesday','wednesday','thursday','friday','saturday','sunday'];
+ $utc_next_open = datetime_convert(date_default_timezone_get(), 'UTC', $week_days[$pernext[0]] . ' ' . $pernext[1], 'c');
+
+ if (is_array($pernext)) {
+ $nowfmt .= t('Next opens') . ' '
+ . '<span data-utc="' . $utc_next_open . '" class="register_date">' . $utc_next_open . '</span>.';
- if (is_array($pernext))
- $nowfmt .= '. ' . t('Next opens') . ' '
- . ucfirst( array('','mo','tu','we','th','fr','sa','so')[$pernext[0]]) . ' '
- . substr($pernext[1],0,2) . ':' . substr($pernext[1],-2);
+ }
}
return array( 'isduty' => $isduty, 'nowfmt' => $nowfmt, 'atform' => $atform);