From 4e164690d589d1fa17970b965c62043b923df13f Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 2 Jun 2021 03:19:55 +0000 Subject: [PATCH 1/2] Use the proper way to display milliseconds --- src/Util/DateTimeFormat.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Util/DateTimeFormat.php b/src/Util/DateTimeFormat.php index d2a96d0357..292fc6150f 100644 --- a/src/Util/DateTimeFormat.php +++ b/src/Util/DateTimeFormat.php @@ -34,7 +34,7 @@ class DateTimeFormat const ATOM = 'Y-m-d\TH:i:s\Z'; const MYSQL = 'Y-m-d H:i:s'; const HTTP = 'D, d M Y H:i:s \G\M\T'; - const API = 'Y-m-d\TH:i:s.000\Z'; + const API = 'Y-m-d\TH:i:s.v\Z'; /** * convert() shorthand for UTC. From e7bc908655e97431c706cb3106af7580c77d0473 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 2 Jun 2021 03:32:42 +0000 Subject: [PATCH 2/2] Renaming the date format to "JSON" --- src/Object/Api/Mastodon/Account.php | 2 +- src/Object/Api/Mastodon/Notification.php | 2 +- src/Object/Api/Mastodon/Status.php | 2 +- src/Object/Api/Mastodon/Token.php | 2 +- src/Util/DateTimeFormat.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Object/Api/Mastodon/Account.php b/src/Object/Api/Mastodon/Account.php index 01febcf363..f9c77675fa 100644 --- a/src/Object/Api/Mastodon/Account.php +++ b/src/Object/Api/Mastodon/Account.php @@ -108,7 +108,7 @@ class Account extends BaseDataTransferObject $userContactCreated = $userContact['created'] ?? DBA::NULL_DATETIME; $created = $userContactCreated < $publicContactCreated && ($userContactCreated != DBA::NULL_DATETIME) ? $userContactCreated : $publicContactCreated; - $this->created_at = DateTimeFormat::utc($created, DateTimeFormat::API); + $this->created_at = DateTimeFormat::utc($created, DateTimeFormat::JSON); $this->note = BBCode::convert($publicContact['about'], false); $this->url = $publicContact['url']; diff --git a/src/Object/Api/Mastodon/Notification.php b/src/Object/Api/Mastodon/Notification.php index 2c2e8d6f9c..579598db6d 100644 --- a/src/Object/Api/Mastodon/Notification.php +++ b/src/Object/Api/Mastodon/Notification.php @@ -52,7 +52,7 @@ class Notification extends BaseDataTransferObject { $this->id = (string)$id; $this->type = $type; - $this->created_at = DateTimeFormat::utc($created_at, DateTimeFormat::API); + $this->created_at = DateTimeFormat::utc($created_at, DateTimeFormat::JSON); $this->account = $account->toArray(); if (!empty($status)) { diff --git a/src/Object/Api/Mastodon/Status.php b/src/Object/Api/Mastodon/Status.php index f236d2231d..0985c0002a 100644 --- a/src/Object/Api/Mastodon/Status.php +++ b/src/Object/Api/Mastodon/Status.php @@ -100,7 +100,7 @@ class Status extends BaseDataTransferObject public function __construct(array $item, Account $account, Counts $counts, UserAttributes $userAttributes, bool $sensitive, Application $application, array $mentions, array $tags, Card $card, array $attachments, array $reblog) { $this->id = (string)$item['uri-id']; - $this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::API); + $this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::JSON); if ($item['gravity'] == GRAVITY_COMMENT) { $this->in_reply_to_id = (string)$item['thr-parent-id']; diff --git a/src/Object/Api/Mastodon/Token.php b/src/Object/Api/Mastodon/Token.php index dfd5de0e95..8bcb837ec3 100644 --- a/src/Object/Api/Mastodon/Token.php +++ b/src/Object/Api/Mastodon/Token.php @@ -53,6 +53,6 @@ class Token extends BaseDataTransferObject $this->access_token = $access_token; $this->token_type = $token_type; $this->scope = $scope; - $this->created_at = DateTimeFormat::utc($created_at, DateTimeFormat::API); + $this->created_at = DateTimeFormat::utc($created_at, DateTimeFormat::JSON); } } diff --git a/src/Util/DateTimeFormat.php b/src/Util/DateTimeFormat.php index 292fc6150f..a1eb749948 100644 --- a/src/Util/DateTimeFormat.php +++ b/src/Util/DateTimeFormat.php @@ -34,7 +34,7 @@ class DateTimeFormat const ATOM = 'Y-m-d\TH:i:s\Z'; const MYSQL = 'Y-m-d H:i:s'; const HTTP = 'D, d M Y H:i:s \G\M\T'; - const API = 'Y-m-d\TH:i:s.v\Z'; + const JSON = 'Y-m-d\TH:i:s.v\Z'; /** * convert() shorthand for UTC.