Change timestamp to be DateTime object not integers in Mastodon Timeline API

This commit is contained in:
Hank Grabowski 2023-02-28 08:20:08 -05:00
parent 6ffd3a3f8c
commit 1adb23d8fd
2 changed files with 13 additions and 15 deletions

View file

@ -156,12 +156,12 @@ class Status extends BaseDataTransferObject
/**
* Returns the current created_at DateTime as an integer timestamp
* @return int
* @return \DateTime
* @throws \Exception
*/
public function createdAtTimestamp(): int
public function createdAtTimestamp(): \DateTime
{
$result = strtotime($this->created_at);
$result = new \DateTime($this->created_at);
if (!$result) {
throw new \Exception('Unknown date-time format');
}