]> git.mxchange.org Git - friendica.git/commitdiff
API: Fix date format
authorMichael <heluecht@pirati.ca>
Tue, 1 Jun 2021 22:32:05 +0000 (22:32 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 1 Jun 2021 22:32:05 +0000 (22:32 +0000)
src/Object/Api/Mastodon/Account.php
src/Object/Api/Mastodon/Notification.php
src/Object/Api/Mastodon/Status.php
src/Object/Api/Mastodon/Token.php
src/Util/DateTimeFormat.php

index 358ad4adedefa972526b839058657c62d8118490..01febcf36376c6d09b8dc39ce3229876d4cd5625 100644 (file)
@@ -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::ATOM);
+               $this->created_at      = DateTimeFormat::utc($created, DateTimeFormat::API);
 
                $this->note            = BBCode::convert($publicContact['about'], false);
                $this->url             = $publicContact['url'];
index ee4930e3cdb569e3b4118892784a61e8f4e14f01..2c2e8d6f9c173786e48ec246009b3d0dfe0ed21f 100644 (file)
@@ -52,7 +52,7 @@ class Notification extends BaseDataTransferObject
        {
                $this->id         = (string)$id;
                $this->type       = $type;
-               $this->created_at = DateTimeFormat::utc($created_at, DateTimeFormat::ATOM);
+               $this->created_at = DateTimeFormat::utc($created_at, DateTimeFormat::API);
                $this->account    = $account->toArray();
 
                if (!empty($status)) {
index 974ac0dc74d5ea9d0934e9c158571d89dff298ee..f236d2231d043f48302a8698c6c06198973ac57a 100644 (file)
@@ -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::ATOM);
+               $this->created_at = DateTimeFormat::utc($item['created'], DateTimeFormat::API);
 
                if ($item['gravity'] == GRAVITY_COMMENT) {
                        $this->in_reply_to_id         = (string)$item['thr-parent-id'];
index 1c78d69593e0c364c36413313390b5871eaa3808..dfd5de0e95d2cf6fb332ac90abf1890d017f6e79 100644 (file)
@@ -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::ATOM);
+               $this->created_at   = DateTimeFormat::utc($created_at, DateTimeFormat::API);
        }
 }
index eefbfcf7bc597db5e12609b8e79b897873985d4a..d2a96d0357193e67a083d5a9a3cfdb00f849279b 100644 (file)
@@ -31,9 +31,10 @@ use Exception;
  */
 class DateTimeFormat
 {
-       const ATOM = 'Y-m-d\TH:i:s\Z';
+       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 HTTP  = 'D, d M Y H:i:s \G\M\T';
+       const API   = 'Y-m-d\TH:i:s.000\Z';
 
        /**
         * convert() shorthand for UTC.