Global date formatting function
This commit is contained in:
parent
a4787387dd
commit
f39389ead4
@ -20,6 +20,10 @@ class Agenda {
|
||||
$this->activities = $activities;
|
||||
}
|
||||
|
||||
public static function getFormattedDate($date) {
|
||||
return trim(strftime('%A %e. %b %H.%M', $date->getTimeStamp()));
|
||||
}
|
||||
|
||||
public function getEventsBetween(DateTimeImmutable $from, DateTimeImmutable $to) {
|
||||
$results = [];
|
||||
for($i = 0; $i < sizeof($this->activities); $i++) {
|
||||
|
@ -4,6 +4,7 @@ date_default_timezone_set('Europe/Oslo');
|
||||
setlocale(LC_ALL, 'no_NO');
|
||||
require __DIR__ . '/../../src/_autoload.php';
|
||||
require __DIR__ . '/../../sql_config.php';
|
||||
use \pvv\side\Agenda;
|
||||
?>
|
||||
<html lang="no">
|
||||
<title>Sosialverkstedet</title>
|
||||
@ -35,7 +36,7 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
||||
<ul class="subtext">
|
||||
<li>Tid:
|
||||
<strong>
|
||||
<?= $nextEvent->getStart()->format('Y-m-d H:i');?>
|
||||
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
||||
</strong>
|
||||
<li>Sted:
|
||||
<strong>
|
||||
|
@ -4,6 +4,7 @@ date_default_timezone_set('Europe/Oslo');
|
||||
setlocale(LC_ALL, 'no_NO');
|
||||
require __DIR__ . '/../../src/_autoload.php';
|
||||
require __DIR__ . '/../../sql_config.php';
|
||||
use \pvv\side\Agenda;
|
||||
?>
|
||||
<html lang="no">
|
||||
<title>Sosialverkstedet</title>
|
||||
@ -36,7 +37,7 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
||||
<ul class="subtext">
|
||||
<li>Tid:
|
||||
<strong>
|
||||
<?= $nextEvent->getStart()->format('Y-m-d H:i');?>
|
||||
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
||||
</strong>
|
||||
<li>Sted:
|
||||
<strong>
|
||||
|
@ -4,6 +4,7 @@ date_default_timezone_set('Europe/Oslo');
|
||||
setlocale(LC_ALL, 'no_NO');
|
||||
require __DIR__ . '/../../src/_autoload.php';
|
||||
require __DIR__ . '/../../sql_config.php';
|
||||
use \pvv\side\Agenda;
|
||||
?>
|
||||
<html lang="no">
|
||||
<title>Sosialverkstedet</title>
|
||||
@ -37,7 +38,7 @@ $nextEvent = $activity->getNextEventFrom(new DateTimeImmutable);
|
||||
<ul class="subtext">
|
||||
<li>Tid:
|
||||
<strong>
|
||||
<?= $nextEvent->getStart()->format('Y-m-d H:i');?>
|
||||
<?= Agenda::getFormattedDate($nextEvent->getStart());?>
|
||||
</strong>
|
||||
<li>Sted:
|
||||
<strong>
|
||||
|
Loading…
Reference in New Issue
Block a user