diff --git a/src/pvv/side/repeatingactivity.php b/src/pvv/side/repeatingactivity.php index 9ad3e7c..9bcda82 100644 --- a/src/pvv/side/repeatingactivity.php +++ b/src/pvv/side/repeatingactivity.php @@ -1,12 +1,12 @@ format('H') > 20 || $date->format('H') == 19 && $date->format('i') > 30) + return $this->nextDate($date->add(new DateInterval('P1D'))); + $date = $date->setTime(19, 30, 0); + if ($date->format('N') != 5) + return $this->nextDate($date->add(new DateInterval('P1D'))); + return $date; + } + + public function prevDate(DateTimeImmutable $date) { + if ($date->format('H') < 19 || $date->format('H') == 20 && $date->format('i') < 30) + return $this->prevDate($date->sub(new DateInterval('P1D'))); + $date = $date->setTime(19, 30, 0); + if ($date->format('N') != 5) + return $this->prevDate($date->sub(new DateInterval('P1D'))); + return $date; + } + + public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ { + return new AnimekveldEvent($this->nextDate($date)); + } + + public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ { + return new AnimekveldEvent($this->prevDate($date)); + } + + public function getName() /* : string */ { + return "Animekveld"; + } + + public function getLocation() /* : Location */ { + return "Peppes Kjøpmansgata"; + } + + public function getOrganiser() /* : User */ { + return "Anders Christensen"; + } + +} diff --git a/src/pvv/side/social/nerdepitsaactivity.php b/src/pvv/side/social/nerdepitsaactivity.php new file mode 100644 index 0000000..4984d96 --- /dev/null +++ b/src/pvv/side/social/nerdepitsaactivity.php @@ -0,0 +1,52 @@ +format('H') > 19) + return $this->nextDate($date->add(new DateInterval('P1D'))->setTime(19, 0, 0)); + $date = $date->setTime(19, 0, 0); + if ($date->format('N') != 5) + return $this->nextDate($date->add(new DateInterval('P1D'))); + if ($date->format('W') % 2) + return $this->nextDate($date->add(new DateInterval('P7D'))); + return $date; + } + + public function prevDate(DateTimeImmutable $date) { + if ($date->format('H') < 19) + return $this->prevDate($date->sub(new DateInterval('P1D'))->setTime(19, 0, 0)); + $date = $date->setTime(19, 0, 0); + if ($date->format('N') != 5) + return $this->prevDate($date->sub(new DateInterval('P1D'))); + if ($date->format('W') % 2) + return $this->prevDate($date->sub(new DateInterval('P7D'))); + return $date; + } + + public function getNextEventFrom(DateTimeImmutable $date) /* : Event */ { + return new NerdepitsaEvent($this->nextDate($date)); + } + + public function getPreviousEventFrom(DateTimeImmutable $date) /* : Event */ { + return new NerdepitsaEvent($this->prevDate($date)); + } + + public function getName() /* : string */ { + return "Nerdepitsa"; + } + + public function getLocation() /* : Location */ { + return "Peppes Kjøpmansgata"; + } + + public function getOrganiser() /* : User */ { + return "Anders Christensen"; + } + +} diff --git a/src/pvv/side/social/testanimekveld.php b/src/pvv/side/social/testanimekveld.php new file mode 100644 index 0000000..86fed78 --- /dev/null +++ b/src/pvv/side/social/testanimekveld.php @@ -0,0 +1,9 @@ +nextDate(new \DateTimeImmutable)->format(DATE_RFC2822)); diff --git a/src/pvv/side/social/testnerdepitsa.php b/src/pvv/side/social/testnerdepitsa.php new file mode 100644 index 0000000..22f385c --- /dev/null +++ b/src/pvv/side/social/testnerdepitsa.php @@ -0,0 +1,9 @@ +prevDate(new \DateTimeImmutable)->format(DATE_RFC2822));