Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forum Bugfix: ForumDraftsTable fix DataTable expects DateTimeImmutable #7610

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions components/ILIAS/Forum/classes/Drafts/ForumDraftsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@

use Generator;
use ilObjUser;
use ilDateTime;
use ilLanguage;
use ilObjForum;
use ilObjForumGUI;
use ilCtrlInterface;
use ilForumPostDraft;
use ILIAS\Data\Order;
use ILIAS\Data\Range;
use DateTimeImmutable;
use ilCalendarSettings;
use ILIAS\UI\URLBuilder;
use ILIAS\UI\Factory as UIFactory;
use ILIAS\Data\Factory as DataFactory;
Expand Down Expand Up @@ -97,7 +98,9 @@ public function initRecords(): void
} else {
$this->records[$draft_id]['draft'] = $draft['subject'];
}
$this->records[$draft_id]['edited_on'] = new ilDateTime($draft['post_update'], IL_CAL_DATETIME);
$this->records[$draft_id]['edited_on'] = new DateTimeImmutable(
$draft['post_update']
);
}
}
}
Expand Down Expand Up @@ -175,13 +178,19 @@ private function limitRecords(array $records, Range $range): array
*/
private function getColumns(): array
{
if ((int) $this->user->getTimeFormat() === ilCalendarSettings::TIME_FORMAT_12) {
$format = $this->data_factory->dateFormat()->withTime12($this->user->getDateFormat());
} else {
$format = $this->data_factory->dateFormat()->withTime24($this->user->getDateFormat());
}

return [
'draft' => $this->ui_factory->table()->column()->link($this->lng->txt('drafts'))->withIsSortable(
false
)->withIsSortable(false),
'edited_on' => $this->ui_factory->table()->column()->date(
$this->lng->txt('edited_on'),
$this->data_factory->dateFormat()->germanLong()
$format
)->withIsSortable(false)
];
}
Expand Down
Loading