Fix issue with duedate format
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
committed by
Julius Härtl
parent
857a0797b4
commit
2c3113334a
@@ -108,7 +108,7 @@ class Card extends RelationalEntity {
|
||||
$this->addType('archived', 'boolean');
|
||||
$this->addType('notified', 'boolean');
|
||||
$this->addType('deletedAt', 'integer');
|
||||
$this->addType('duedate', 'string');
|
||||
$this->addType('duedate', 'datetime');
|
||||
$this->addRelation('labels');
|
||||
$this->addRelation('assignedUsers');
|
||||
$this->addRelation('attachments');
|
||||
@@ -126,20 +126,6 @@ class Card extends RelationalEntity {
|
||||
$this->databaseType = $type;
|
||||
}
|
||||
|
||||
public function getDueDateTime(): ?DateTime {
|
||||
return $this->duedate ? new DateTime($this->duedate) : null;
|
||||
}
|
||||
|
||||
public function getDuedate($isoFormat = false): ?string {
|
||||
$dt = $this->getDueDateTime();
|
||||
$format = 'c';
|
||||
if (!$isoFormat && $this->databaseType === 'mysql') {
|
||||
$format = 'Y-m-d H:i:s';
|
||||
}
|
||||
|
||||
return $dt ? $dt->format($format) : null;
|
||||
}
|
||||
|
||||
public function getCalendarObject(): VCalendar {
|
||||
$calendar = new VCalendar();
|
||||
$event = $calendar->createComponent('VTODO');
|
||||
@@ -148,7 +134,7 @@ class Card extends RelationalEntity {
|
||||
$creationDate = new DateTime();
|
||||
$creationDate->setTimestamp($this->createdAt);
|
||||
$event->DTSTAMP = $creationDate;
|
||||
$event->DUE = new DateTime($this->getDuedate(true), new DateTimeZone('UTC'));
|
||||
$event->DUE = new DateTime($this->getDuedate()->format('c'), new DateTimeZone('UTC'));
|
||||
}
|
||||
$event->add('RELATED-TO', 'deck-stack-' . $this->getStackId());
|
||||
|
||||
|
||||
@@ -72,6 +72,9 @@ class RelationalEntity extends Entity implements \JsonSerializable {
|
||||
$propertyReflection = $reflection->getProperty($property);
|
||||
if (!$propertyReflection->isPrivate() && !in_array($property, $this->_resolvedProperties, true)) {
|
||||
$json[$property] = $this->getter($property);
|
||||
if ($json[$property] instanceof \DateTimeInterface) {
|
||||
$json[$property] = $json[$property]->format('c');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class CardDetails extends Card {
|
||||
$today = new DateTime();
|
||||
$today->setTime(0, 0);
|
||||
|
||||
$match_date = $this->card->getDueDateTime();
|
||||
$match_date = $this->card->getDuedate();
|
||||
if (!$match_date) {
|
||||
return Card::DUEDATE_FUTURE;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class NotificationHelper {
|
||||
->setSubject('card-overdue', [
|
||||
$card->getTitle(), $board->getTitle()
|
||||
])
|
||||
->setDateTime(new DateTime($card->getDuedate()));
|
||||
->setDateTime($card->getDuedate());
|
||||
$this->notificationManager->notify($notification);
|
||||
}
|
||||
}
|
||||
@@ -242,7 +242,7 @@ class NotificationHelper {
|
||||
}
|
||||
return $this->boards[$boardId];
|
||||
}
|
||||
|
||||
|
||||
private function generateBoardShared(Board $board, string $userId): INotification {
|
||||
$notification = $this->notificationManager->createNotification();
|
||||
$notification
|
||||
|
||||
@@ -337,11 +337,11 @@ class CardService {
|
||||
$card->setType($type);
|
||||
$card->setOrder($order);
|
||||
$card->setOwner($owner);
|
||||
$card->setDuedate($duedate);
|
||||
$card->setDuedate(new \DateTime($duedate));
|
||||
$resetDuedateNotification = false;
|
||||
if (
|
||||
$card->getDuedate() === null ||
|
||||
(new \DateTime($card->getDuedate())) != (new \DateTime($changes->getBefore()->getDuedate() ?? ''))
|
||||
($card->getDuedate()) != ($changes->getBefore()->getDuedate())
|
||||
) {
|
||||
$card->setNotified(false);
|
||||
$resetDuedateNotification = true;
|
||||
|
||||
Reference in New Issue
Block a user