Skip to content

Commit

Permalink
Chatroom: Add missing typecast for JS timestamps (ms)
Browse files Browse the repository at this point in the history
  • Loading branch information
lscharmer authored and mjansenDatabay committed Dec 17, 2024
1 parent 1a90574 commit 88e8f9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Modules/Chatroom/classes/class.ilChatroom.php
Original file line number Diff line number Diff line change
Expand Up @@ -1296,8 +1296,8 @@ public function getLastMessages(int $number, ilChatroomUser $chatuser): array
}

usort($results, static function (stdClass $a, stdClass $b): int {
$a_timestamp = strlen((string) $a->timestamp) === 13 ? ((int) substr($a->timestamp, 0, -3)) : $a->timestamp;
$b_timestamp = strlen((string) $b->timestamp) === 13 ? ((int) substr($b->timestamp, 0, -3)) : $b->timestamp;
$a_timestamp = strlen((string) $a->timestamp) === 13 ? ((int) substr((string) $a->timestamp, 0, -3)) : $a->timestamp;
$b_timestamp = strlen((string) $b->timestamp) === 13 ? ((int) substr((string) $b->timestamp, 0, -3)) : $b->timestamp;

return $b_timestamp - $a_timestamp;
});
Expand Down

0 comments on commit 88e8f9c

Please sign in to comment.