use Friendica\Model\Group;
use Friendica\Model\Profile;
use Friendica\Protocol\DFRN;
+use Friendica\Util\DateTimeFormat;
use Friendica\Util\Temporal;
require_once 'include/event.php';
// The view mode part is similiar to /mod/events.php
if ($mode == 'view') {
- $thisyear = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'Y');
- $thismonth = Temporal::convert('now', date_default_timezone_get(), 'UTC', 'm');
+ $thisyear = DateTimeFormat::localNow('Y');
+ $thismonth = DateTimeFormat::localNow('m');
if (!$y) {
$y = intval($thisyear);
}
$prevyear --;
}
- $dim = get_dim($y, $m);
+ $dim = Temporal::getDaysInMonth($y, $m);
$start = sprintf('%d-%d-%d %d:%d:%d', $y, $m, 1, 0, 0, 0);
$finish = sprintf('%d-%d-%d %d:%d:%d', $y, $m, $dim, 23, 59, 59);
}
}
- $start = Temporal::convert($start);
- $finish = Temporal::convert($finish);
+ $start = DateTimeFormat::utc($start);
+ $finish = DateTimeFormat::utc($finish);
- $adjust_start = Temporal::convert($start, date_default_timezone_get());
- $adjust_finish = Temporal::convert($finish, date_default_timezone_get());
+ $adjust_start = DateTimeFormat::local($start);
+ $adjust_finish = DateTimeFormat::local($finish);
// put the event parametes in an array so we can better transmit them
$event_params = [
if (DBM::is_result($r)) {
$r = sort_by_date($r);
foreach ($r as $rr) {
- $j = (($rr['adjust']) ? Temporal::convert($rr['start'], date_default_timezone_get(), 'UTC', 'j') : Temporal::convert($rr['start'], 'UTC', 'UTC', 'j'));
+ $j = $rr['adjust'] ? DateTimeFormat::local($rr['start'], 'j') : DateTimeFormat::utc($rr['start'], 'j');
if (!x($links, $j)) {
$links[$j] = System::baseUrl() . '/' . $a->cmd . '#link-' . $j;
}
'$view' => L10n::t('View'),
'$previous' => [System::baseUrl() . "/events/$prevyear/$prevmonth", L10n::t('Previous'), '', ''],
'$next' => [System::baseUrl() . "/events/$nextyear/$nextmonth", L10n::t('Next'), '', ''],
- '$calendar' => cal($y, $m, $links, ' eventcal'),
+ '$calendar' => Temporal::getCalendarTable($y, $m, $links, ' eventcal'),
'$events' => $events,
"today" => L10n::t("today"),
"month" => L10n::t("month"),