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