From 858912fff89b8a542584fcbdb2cd04039039174d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gangloff?= Date: Thu, 9 Jan 2025 13:57:44 +0100 Subject: [PATCH] feat: add estimated WHOIS release date in ICS --- src/Controller/WatchListController.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Controller/WatchListController.php b/src/Controller/WatchListController.php index d4a52ad..303c41a 100644 --- a/src/Controller/WatchListController.php +++ b/src/Controller/WatchListController.php @@ -319,12 +319,29 @@ class WatchListController extends AbstractController $calendar->addEvent((new Event()) ->setLastModified(new Timestamp($domain->getUpdatedAt())) ->setStatus(EventStatus::CONFIRMED()) - ->setSummary($domain->getLdhName().' ('.$event->getAction().')') + ->setSummary($domain->getLdhName().': '.$event->getAction()) ->addCategory(new Category($event->getAction())) ->setAttendees($attendees) ->setOccurrence(new SingleDay(new Date($event->getDate()))) ); } + + $expiresInDays = $domain->getExpiresInDays(); + + if (null === $expiresInDays) { + continue; + } + + $calendar->addEvent((new Event()) + ->setLastModified(new Timestamp($domain->getUpdatedAt())) + ->setStatus(EventStatus::CONFIRMED()) + ->setSummary($domain->getLdhName().': estimated WHOIS release date') + ->addCategory(new Category('release')) + ->setAttendees($attendees) + ->setOccurrence(new SingleDay(new Date( + (new \DateTimeImmutable())->setTime(0, 0)->add(new \DateInterval('P'.$expiresInDays.'D')) + ))) + ); } $calendarResponse = (new CalendarFactory())->createCalendar($calendar);