Skip to content

Commit

Permalink
feat(appointments): add timezone to all emails
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Larch <[email protected]>
  • Loading branch information
miaulalala committed Sep 18, 2024
1 parent a31a386 commit a3fb3db
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/Service/Appointments/MailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,24 @@ private function addBulletList(IEMailTemplate $template,
bool $recipient): void {
$template->addBodyListItem($booking->getDisplayName(), $l10n->t('Appointment for:'));

// determain timezone depending on who is getting the message (Requestee/Requester)
// determine timezone depending on who is getting the message (Requestee/Requester)
$tzid = ($recipient) ? $config->getAvailabilityAsArray()['timezoneId'] : $booking->getTimezone();
$dtstart = new \DateTime('now', new \DateTimeZone($booking->getTimezone())); // generate DateTime with booking time zone
$dtstart->setTimestamp($booking->getStart()); // set booking time stamp

$l = $this->lFactory->findGenericLanguage();
$relativeTimezone = new \DateTimeZone($tzid);
$relativeDateTime = $this->dateFormatter->formatDateTimeRelativeDay(
$dtstart,
'long',
'short',
new \DateTimeZone($tzid),
$relativeTimezone,
$this->lFactory->get('calendar', $l)
);

$template->addBodyListItem($relativeDateTime, $l10n->t('Date:'));
$timestring = $relativeDateTime . ' (' . $relativeTimezone->getName() . ')';

$template->addBodyListItem($timestring, $l10n->t('Date:'));

if (!$booking->isConfirmed() && $config->getCreateTalkRoom()) {
$template->addBodyListItem($l10n->t('You will receive a link with the confirmation email'), $l10n->t('Where:'));
Expand Down

0 comments on commit a3fb3db

Please sign in to comment.