Change ISO-8601 to RFC 3339 EXTENDED

This commit is contained in:
noellabo 2022-05-21 04:22:59 +09:00
parent 1bdfa7a4a2
commit 2093d1b33b
10 changed files with 11 additions and 11 deletions

View file

@ -1008,7 +1008,7 @@ class ApiV1Controller extends Controller
->map(function($like) { ->map(function($like) {
$status = StatusService::getMastodon($like['status_id'], false); $status = StatusService::getMastodon($like['status_id'], false);
$status['like_id'] = $like->id; $status['like_id'] = $like->id;
$status['liked_at'] = $like->created_at->format('c'); $status['liked_at'] = str_replace('+00:00', 'Z', $like->created_at->format(DATE_RFC3339_EXTENDED));
return $status; return $status;
}) })
->filter(function($status) { ->filter(function($status) {

View file

@ -19,7 +19,7 @@ class InstanceApiController extends Controller {
'acct' => $admin->username, 'acct' => $admin->username,
'display_name' => e($admin->name), 'display_name' => e($admin->name),
'locked' => (bool) $admin->is_private, 'locked' => (bool) $admin->is_private,
'created_at' => $admin->created_at->format('c'), 'created_at' => str_replace('+00:00', 'Z', $admin->created_at->format(DATE_RFC3339_EXTENDED)),
'note' => e($admin->bio), 'note' => e($admin->bio),
'url' => $admin->url(), 'url' => $admin->url(),
'avatar' => $admin->avatarUrl(), 'avatar' => $admin->avatarUrl(),

View file

@ -326,7 +326,7 @@ class InternalApiController extends Controller
if(!$status) { if(!$status) {
return false; return false;
} }
$status['bookmarked_at'] = $bookmark->created_at->format('c'); $status['bookmarked_at'] = str_replace('+00:00', 'Z', $bookmark->created_at->format(DATE_RFC3339_EXTENDED));
if($status) { if($status) {
BookmarkService::add($pid, $status['id']); BookmarkService::add($pid, $status['id']);

View file

@ -37,7 +37,7 @@ class AdminStatsService
return Cache::remember('admin:dashboard:storage:stats', 120000, function() { return Cache::remember('admin:dashboard:storage:stats', 120000, function() {
$res = []; $res = [];
$res['last_updated'] = now()->format('c'); $res['last_updated'] = str_replace('+00:00', 'Z', now()->format(DATE_RFC3339_EXTENDED));
$avatars = Avatar::count(); $avatars = Avatar::count();
$avatarsLocal = Avatar::whereNull('cdn_url')->count(); $avatarsLocal = Avatar::whereNull('cdn_url')->count();

View file

@ -20,7 +20,7 @@ class MarkerService
$val = [ $val = [
'last_read_id' => (string) $entityId, 'last_read_id' => (string) $entityId,
'version' => $existing ? ($existing['version'] + 1) : 1, 'version' => $existing ? ($existing['version'] + 1) : 1,
'updated_at' => now()->format('c') 'updated_at' => str_replace('+00:00', 'Z', now()->format(DATE_RFC3339_EXTENDED))
]; ];
Cache::put($key, $val, 2592000); Cache::put($key, $val, 2592000);
return $val; return $val;

View file

@ -19,7 +19,7 @@ class PollService
$poll = Poll::whereStatusId($id)->firstOrFail(); $poll = Poll::whereStatusId($id)->firstOrFail();
return [ return [
'id' => (string) $poll->id, 'id' => (string) $poll->id,
'expires_at' => $poll->expires_at->format('c'), 'expires_at' => str_replace('+00:00', 'Z', $poll->expires_at->format(DATE_RFC3339_EXTENDED)),
'expired' => null, 'expired' => null,
'multiple' => $poll->multiple, 'multiple' => $poll->multiple,
'votes_count' => $poll->votes_count, 'votes_count' => $poll->votes_count,

View file

@ -333,7 +333,7 @@ class Status extends Model
'id' => $this->permalink(), 'id' => $this->permalink(),
'type' => 'Create', 'type' => 'Create',
'actor' => $profile->permalink(), 'actor' => $profile->permalink(),
'published' => $this->created_at->format('c'), 'published' => str_replace('+00:00', 'Z', $this->created_at->format(DATE_RFC3339_EXTENDED)),
'to' => $to, 'to' => $to,
'cc' => $cc, 'cc' => $cc,
'object' => [ 'object' => [
@ -341,7 +341,7 @@ class Status extends Model
'type' => 'Note', 'type' => 'Note',
'summary' => null, 'summary' => null,
'inReplyTo' => null, 'inReplyTo' => null,
'published' => $this->created_at->format('c'), 'published' => str_replace('+00:00', 'Z', $this->created_at->format(DATE_RFC3339_EXTENDED)),
'url' => $this->url(), 'url' => $this->url(),
'attributedTo' => $this->profile->url(), 'attributedTo' => $this->profile->url(),
'to' => $to, 'to' => $to,

View file

@ -16,7 +16,7 @@ class NotificationTransformer extends Fractal\TransformerAbstract
$res = [ $res = [
'id' => (string) $notification->id, 'id' => (string) $notification->id,
'type' => $this->replaceTypeVerb($notification->action), 'type' => $this->replaceTypeVerb($notification->action),
'created_at' => (string) $notification->created_at->format('c'), 'created_at' => (string) str_replace('+00:00', 'Z', $notification->created_at->format(DATE_RFC3339_EXTENDED)),
]; ];
$n = $notification; $n = $notification;

View file

@ -35,7 +35,7 @@ class StatusStatelessTransformer extends Fractal\TransformerAbstract
'reblog' => null, 'reblog' => null,
'content' => $status->rendered ?? $status->caption, 'content' => $status->rendered ?? $status->caption,
'content_text' => $status->caption, 'content_text' => $status->caption,
'created_at' => $status->created_at->format('c'), 'created_at' => str_replace('+00:00', 'Z', $status->created_at->format(DATE_RFC3339_EXTENDED)),
'emojis' => CustomEmoji::scan($status->caption), 'emojis' => CustomEmoji::scan($status->caption),
'reblogs_count' => $status->reblogs_count ?? 0, 'reblogs_count' => $status->reblogs_count ?? 0,
'favourites_count' => $status->likes_count ?? 0, 'favourites_count' => $status->likes_count ?? 0,

View file

@ -38,7 +38,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
'reblog' => null, 'reblog' => null,
'content' => $status->rendered ?? $status->caption, 'content' => $status->rendered ?? $status->caption,
'content_text' => $status->caption, 'content_text' => $status->caption,
'created_at' => $status->created_at->format('c'), 'created_at' => str_replace('+00:00', 'Z', $status->created_at->format(DATE_RFC3339_EXTENDED)),
'emojis' => CustomEmoji::scan($status->caption), 'emojis' => CustomEmoji::scan($status->caption),
'reblogs_count' => 0, 'reblogs_count' => 0,
'favourites_count' => $status->likes_count ?? 0, 'favourites_count' => $status->likes_count ?? 0,