]> BookStack Code Mirror - bookstack/commitdiff
Timezones: Updated date displays to use consistent formats 5790/head
authorDan Brown <redacted>
Thu, 4 Sep 2025 15:11:35 +0000 (16:11 +0100)
committerDan Brown <redacted>
Thu, 4 Sep 2025 15:11:35 +0000 (16:11 +0100)
20 files changed:
app/Entities/Tools/PageEditActivity.php
app/Util/DateFormatter.php
phpunit.xml
resources/views/comments/comment.blade.php
resources/views/common/activity-item.blade.php
resources/views/entities/grid-item.blade.php
resources/views/entities/list-item.blade.php
resources/views/entities/meta.blade.php
resources/views/exports/import-show.blade.php
resources/views/exports/parts/import.blade.php
resources/views/exports/parts/meta.blade.php
resources/views/pages/parts/image-manager-form.blade.php
resources/views/pages/parts/revisions-index-row.blade.php
resources/views/pages/parts/template-manager-list.blade.php
resources/views/settings/webhooks/edit.blade.php
resources/views/users/api-tokens/edit.blade.php
resources/views/users/parts/users-list-item.blade.php
resources/views/users/profile.blade.php
tests/Exports/HtmlExportTest.php
tests/Util/DateFormatterTest.php

index 646b200f1da2ed17a3e5fb803458dabd2330a27e..22f89bf62be4da59ad040fc1e7cdda32baf63852 100644 (file)
@@ -4,19 +4,15 @@ namespace BookStack\Entities\Tools;
 
 use BookStack\Entities\Models\Page;
 use BookStack\Entities\Models\PageRevision;
+use BookStack\Util\DateFormatter;
 use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Builder;
 
 class PageEditActivity
 {
-    protected Page $page;
-
-    /**
-     * PageEditActivity constructor.
-     */
-    public function __construct(Page $page)
-    {
-        $this->page = $page;
+    public function __construct(
+        protected Page $page
+    ) {
     }
 
     /**
@@ -50,11 +46,9 @@ class PageEditActivity
     /**
      * Get any editor clash warning messages to show for the given draft revision.
      *
-     * @param PageRevision|Page $draft
-     *
      * @return string[]
      */
-    public function getWarningMessagesForDraft($draft): array
+    public function getWarningMessagesForDraft(Page|PageRevision $draft): array
     {
         $warnings = [];
 
@@ -82,7 +76,8 @@ class PageEditActivity
      */
     public function getEditingActiveDraftMessage(PageRevision $draft): string
     {
-        $message = trans('entities.pages_editing_draft_notification', ['timeDiff' => $draft->updated_at->diffForHumans()]);
+        $formatter = resolve(DateFormatter::class);
+        $message = trans('entities.pages_editing_draft_notification', ['timeDiff' => $formatter->relative($draft->updated_at)]);
         if ($draft->page->updated_at->timestamp <= $draft->updated_at->timestamp) {
             return $message;
         }
index 489ed54e2ca44bbae7b1fa163d3a3a78839f1c18..c6e60bd53991f092b75c88340bc53b4e2c77960f 100644 (file)
@@ -3,6 +3,7 @@
 namespace BookStack\Util;
 
 use Carbon\Carbon;
+use Carbon\CarbonInterface;
 
 class DateFormatter
 {
@@ -11,15 +12,15 @@ class DateFormatter
     ) {
     }
 
-    public function isoWithTimezone(Carbon $date): string
+    public function absolute(Carbon $date): string
     {
         $withDisplayTimezone = $date->clone()->setTimezone($this->displayTimezone);
 
         return $withDisplayTimezone->format('Y-m-d H:i:s T');
     }
 
-    public function relative(Carbon $date): string
+    public function relative(Carbon $date, bool $includeSuffix = true): string
     {
-        return $date->diffForHumans();
+        return $date->diffForHumans(null, $includeSuffix ? null : CarbonInterface::DIFF_ABSOLUTE);
     }
 }
index a8e725d4106596bdae83bf48757b02a83a580ec9..8a7ab9cb7a3f4c7fcb9478083d6d4b1e7d913055 100644 (file)
@@ -16,6 +16,8 @@
     <server name="APP_THEME" value="none"/>
     <server name="APP_AUTO_LANG_PUBLIC" value="true"/>
     <server name="APP_URL" value="http://bookstack.dev"/>
+    <server name="APP_TIMEZONE" value="UTC"/>
+    <server name="APP_DISPLAY_TIMEZONE" value="UTC"/>
     <server name="ALLOWED_IFRAME_HOSTS" value=""/>
     <server name="ALLOWED_IFRAME_SOURCES" value="https://*.draw.io https://*.youtube.com https://*.youtube-nocookie.com https://*.vimeo.com"/>
     <server name="ALLOWED_SSR_HOSTS" value="*"/>
index d70a8c1d909b1d1b55f88347060b1049186ad46b..67aac7203571366b5b51293486904b233b541e8b 100644 (file)
@@ -14,7 +14,8 @@
         <div class="flex-container-row wrap items-center gap-x-xs">
             @if ($comment->createdBy)
                 <div>
-                    <img width="50" src="{{ $comment->createdBy->getAvatar(50) }}" class="avatar block mr-xs" alt="{{ $comment->createdBy->name }}">
+                    <img width="50" src="{{ $comment->createdBy->getAvatar(50) }}" class="avatar block mr-xs"
+                         alt="{{ $comment->createdBy->name }}">
                 </div>
             @endif
             <div class="meta text-muted flex-container-row wrap items-center flex text-small">
                 @else
                     {{ trans('common.deleted_user') }}
                 @endif
-                <span title="{{ $comment->created_at }}">&nbsp;{{ trans('entities.comment_created', ['createDiff' => $comment->created_at->diffForHumans() ]) }}</span>
+                <span title="{{ $dates->absolute($comment->created_at) }}">&nbsp;{{ trans('entities.comment_created', ['createDiff' => $dates->relative($comment->created_at) ]) }}</span>
                 @if($comment->isUpdated())
                     <span class="mx-xs">&bull;</span>
-                    <span title="{{ trans('entities.comment_updated', ['updateDiff' => $comment->updated_at, 'username' => $comment->updatedBy->name ?? trans('common.deleted_user')]) }}">
+                    <span title="{{ trans('entities.comment_updated', ['updateDiff' => $dates->absolute($comment->updated_at), 'username' => $comment->updatedBy->name ?? trans('common.deleted_user')]) }}">
                  {{ trans('entities.comment_updated_indicator') }}
                     </span>
                 @endif
             </div>
             <div class="right-meta flex-container-row justify-flex-end items-center px-s">
                 @if(!$readOnly && (userCan('comment-create-all') || userCan('comment-update', $comment) || userCan('comment-delete', $comment)))
-                <div class="actions mr-s">
-                    @if(userCan('comment-create-all'))
-                        <button refs="page-comment@reply-button" type="button" class="text-button text-muted hover-underline text-small p-xs">@icon('reply') {{ trans('common.reply') }}</button>
-                    @endif
-                    @if(!$comment->parent_id && (userCan('comment-update', $comment) || userCan('comment-delete', $comment)))
-                        <button refs="page-comment@archive-button"
-                                type="button"
-                                data-is-archived="{{ $comment->archived ? 'true' : 'false' }}"
-                                class="text-button text-muted hover-underline text-small p-xs">@icon('archive') {{ trans('common.' . ($comment->archived ? 'unarchive' : 'archive')) }}</button>
-                    @endif
-                    @if(userCan('comment-update', $comment))
-                        <button refs="page-comment@edit-button" type="button" class="text-button text-muted hover-underline text-small p-xs">@icon('edit') {{ trans('common.edit') }}</button>
-                    @endif
-                    @if(userCan('comment-delete', $comment))
-                        <div component="dropdown" class="dropdown-container">
-                            <button type="button" refs="dropdown@toggle" aria-haspopup="true" aria-expanded="false" class="text-button text-muted hover-underline text-small p-xs">@icon('delete') {{ trans('common.delete') }}</button>
-                            <ul refs="dropdown@menu" class="dropdown-menu" role="menu">
-                                <li class="px-m text-small text-muted pb-s">{{trans('entities.comment_delete_confirm')}}</li>
-                                <li>
-                                    <button refs="page-comment@delete-button" type="button" class="text-button text-neg icon-item">
-                                        @icon('delete')
-                                        <div>{{ trans('common.delete') }}</div>
-                                    </button>
-                                </li>
-                            </ul>
-                        </div>
-                    @endif
-                    <span class="text-muted">
+                    <div class="actions mr-s">
+                        @if(userCan('comment-create-all'))
+                            <button refs="page-comment@reply-button" type="button"
+                                    class="text-button text-muted hover-underline text-small p-xs">@icon('reply') {{ trans('common.reply') }}</button>
+                        @endif
+                        @if(!$comment->parent_id && (userCan('comment-update', $comment) || userCan('comment-delete', $comment)))
+                            <button refs="page-comment@archive-button"
+                                    type="button"
+                                    data-is-archived="{{ $comment->archived ? 'true' : 'false' }}"
+                                    class="text-button text-muted hover-underline text-small p-xs">@icon('archive') {{ trans('common.' . ($comment->archived ? 'unarchive' : 'archive')) }}</button>
+                        @endif
+                        @if(userCan('comment-update', $comment))
+                            <button refs="page-comment@edit-button" type="button"
+                                    class="text-button text-muted hover-underline text-small p-xs">@icon('edit') {{ trans('common.edit') }}</button>
+                        @endif
+                        @if(userCan('comment-delete', $comment))
+                            <div component="dropdown" class="dropdown-container">
+                                <button type="button" refs="dropdown@toggle" aria-haspopup="true" aria-expanded="false"
+                                        class="text-button text-muted hover-underline text-small p-xs">@icon('delete') {{ trans('common.delete') }}</button>
+                                <ul refs="dropdown@menu" class="dropdown-menu" role="menu">
+                                    <li class="px-m text-small text-muted pb-s">{{trans('entities.comment_delete_confirm')}}</li>
+                                    <li>
+                                        <button refs="page-comment@delete-button" type="button"
+                                                class="text-button text-neg icon-item">
+                                            @icon('delete')
+                                            <div>{{ trans('common.delete') }}</div>
+                                        </button>
+                                    </li>
+                                </ul>
+                            </div>
+                        @endif
+                        <span class="text-muted">
                         &nbsp;&bull;&nbsp;
                     </span>
-                </div>
+                    </div>
                 @endif
                 <div>
-                    <a class="bold text-muted text-small" href="#comment{{$comment->local_id}}">#{{$comment->local_id}}</a>
+                    <a class="bold text-muted text-small"
+                       href="#comment{{$comment->local_id}}">#{{$comment->local_id}}</a>
                 </div>
             </div>
         </div>
@@ -76,7 +82,8 @@
     <div refs="page-comment@content-container" class="content">
         @if ($comment->parent_id)
             <p class="comment-reply">
-                <a class="text-muted text-small" href="#comment{{ $comment->parent_id }}">@icon('reply'){{ trans('entities.comment_in_reply_to', ['commentId' => '#' . $comment->parent_id]) }}</a>
+                <a class="text-muted text-small"
+                   href="#comment{{ $comment->parent_id }}">@icon('reply'){{ trans('entities.comment_in_reply_to', ['commentId' => '#' . $comment->parent_id]) }}</a>
             </p>
         @endif
         @if($comment->content_ref)
@@ -86,7 +93,8 @@
                    option:page-comment-reference:view-comment-text="{{ trans('entities.comment_view') }}"
                    option:page-comment-reference:jump-to-thread-text="{{ trans('entities.comment_jump_to_thread') }}"
                    option:page-comment-reference:close-text="{{ trans('common.close') }}"
-                   href="#">@icon('bookmark'){{ trans('entities.comment_reference') }} <span>{{ trans('entities.comment_reference_outdated') }}</span></a>
+                   href="#">@icon('bookmark'){{ trans('entities.comment_reference') }}
+                    <span>{{ trans('entities.comment_reference_outdated') }}</span></a>
             </div>
         @endif
         {!! $commentHtml  !!}
     @if(!$readOnly && userCan('comment-update', $comment))
         <form novalidate refs="page-comment@form" hidden class="content pt-s px-s block">
             <div class="form-group description-input">
-                <textarea refs="page-comment@input" name="html" rows="3" placeholder="{{ trans('entities.comment_placeholder') }}">{{ $commentHtml }}</textarea>
+                <textarea refs="page-comment@input" name="html" rows="3"
+                          placeholder="{{ trans('entities.comment_placeholder') }}">{{ $commentHtml }}</textarea>
             </div>
             <div class="form-group text-right">
-                <button type="button" class="button outline" refs="page-comment@form-cancel">{{ trans('common.cancel') }}</button>
+                <button type="button" class="button outline"
+                        refs="page-comment@form-cancel">{{ trans('common.cancel') }}</button>
                 <button type="submit" class="button">{{ trans('entities.comment_save') }}</button>
             </div>
         </form>
index 1c970084f6a98785b54d9f13b2eebff2b5012248..1d3c7bd755ff440add41e4925bc4a3d880fb9f6a 100644 (file)
@@ -26,5 +26,5 @@
 
     <br>
 
-    <span class="text-muted"><small>@icon('time'){{ $activity->created_at->diffForHumans() }}</small></span>
+    <span class="text-muted" title="{{ $dates->absolute($activity->created_at) }}"><small>@icon('time'){{ $dates->relative($activity->created_at) }}</small></span>
 </div>
index ee31b53f2e9b4b4ac1ecff69e74179bd10b29617..17c54e26353608d25d535d5701b3152462468562 100644 (file)
@@ -10,7 +10,7 @@
         <p class="text-muted">{{ $entity->getExcerpt(130) }}</p>
     </div>
     <div class="grid-card-footer text-muted ">
-        <p>@icon('star')<span title="{{ $entity->created_at->toDayDateTimeString() }}">{{ trans('entities.meta_created', ['timeLength' => $entity->created_at->diffForHumans()]) }}</span></p>
-        <p>@icon('edit')<span title="{{ $entity->updated_at->toDayDateTimeString() }}">{{ trans('entities.meta_updated', ['timeLength' => $entity->updated_at->diffForHumans()]) }}</span></p>
+        <p>@icon('star')<span title="{{ $dates->absolute($entity->created_at) }}">{{ trans('entities.meta_created', ['timeLength' => $dates->relative($entity->created_at)]) }}</span></p>
+        <p>@icon('edit')<span title="{{ $dates->absolute($entity->updated_at) }}">{{ trans('entities.meta_updated', ['timeLength' => $dates->relative($entity->updated_at)]) }}</span></p>
     </div>
 </a>
\ No newline at end of file
index 2fadef1919360958f8acd014fd25116c62cac40d..5174de4319788d3b14ad78da510a5de737c85fed 100644 (file)
@@ -27,9 +27,9 @@
 @endif
 
 @if(($showUpdatedBy ?? false) && $entity->relationLoaded('updatedBy') && $entity->updatedBy)
-    <small title="{{ $entity->updated_at->toDayDateTimeString() }}">
+    <small title="{{ $dates->absolute($entity->updated_at) }}">
         {!! trans('entities.meta_updated_name', [
-            'timeLength' => $entity->updated_at->diffForHumans(),
+            'timeLength' => $dates->relative($entity->updated_at),
             'user' => e($entity->updatedBy->name)
         ]) !!}
     </small>
index c9d301aa3545d2ee9ffe6088f70473a527995181..060c197a466db18713d443120e012b3ce885332a 100644 (file)
@@ -31,7 +31,7 @@
             @icon('star')
             <div>
                 {!! trans('entities.meta_created_name', [
-                    'timeLength' => '<span title="'. $dates->isoWithTimezone($entity->created_at) .'">'. $dates->relative($entity->created_at) . '</span>',
+                    'timeLength' => '<span title="'. $dates->absolute($entity->created_at) .'">'. $dates->relative($entity->created_at) . '</span>',
                     'user' => "<a href='{$entity->createdBy->getProfileUrl()}'>".e($entity->createdBy->name). "</a>"
                 ]) !!}
             </div>
@@ -39,7 +39,7 @@
     @else
         <div class="entity-meta-item">
             @icon('star')
-            <span title="{{ $dates->isoWithTimezone($entity->created_at) }}">{{ trans('entities.meta_created', ['timeLength' => $dates->relative($entity->created_at)]) }}</span>
+            <span title="{{ $dates->absolute($entity->created_at) }}">{{ trans('entities.meta_created', ['timeLength' => $dates->relative($entity->created_at)]) }}</span>
         </div>
     @endif
 
@@ -48,7 +48,7 @@
             @icon('edit')
             <div>
                 {!! trans('entities.meta_updated_name', [
-                    'timeLength' => '<span title="' . $dates->isoWithTimezone($entity->updated_at) .'">' . $dates->relative($entity->updated_at) .'</span>',
+                    'timeLength' => '<span title="' . $dates->absolute($entity->updated_at) .'">' . $dates->relative($entity->updated_at) .'</span>',
                     'user' => "<a href='{$entity->updatedBy->getProfileUrl()}'>".e($entity->updatedBy->name). "</a>"
                 ]) !!}
             </div>
@@ -56,7 +56,7 @@
     @elseif (!$entity->isA('revision'))
         <div class="entity-meta-item">
             @icon('edit')
-            <span title="{{ $dates->isoWithTimezone($entity->updated_at) }}">{{ trans('entities.meta_updated', ['timeLength' => $dates->relative($entity->updated_at)]) }}</span>
+            <span title="{{ $dates->absolute($entity->updated_at) }}">{{ trans('entities.meta_updated', ['timeLength' => $dates->relative($entity->updated_at)]) }}</span>
         </div>
     @endif
 
index a28b79bb35c3fe0535d8d1635ad402729dc287bd..1c46b7a0b8766f7ad7e9e8ff28c30b387705bf60 100644 (file)
@@ -26,7 +26,7 @@
                     </div>
                     <div class="text-right text-muted">
                         <div>{{ trans('entities.import_size', ['size' => $import->getSizeString()]) }}</div>
-                        <div><span title="{{ $import->created_at->toISOString() }}">{{ trans('entities.import_uploaded_at', ['relativeTime' => $import->created_at->diffForHumans()]) }}</span></div>
+                        <div><span title="{{ $dates->absolute($import->created_at) }}">{{ trans('entities.import_uploaded_at', ['relativeTime' => $dates->relative($import->created_at)]) }}</span></div>
                         @if($import->createdBy)
                             <div>
                                 {{ trans('entities.import_uploaded_by') }}
index 2f7659c469e39a4ea197ca11893b5bb8ee2cd021..dc287370e70fb8cd8598867654ad3e180d3beea5 100644 (file)
@@ -5,6 +5,6 @@
     </div>
     <div class="px-m py-s flex-container-row gap-m items-center">
         <div class="bold opacity-80 text-muted">{{ $import->getSizeString() }}</div>
-        <div class="bold opacity-80 text-muted min-width-xs text-right" title="{{ $import->created_at->toISOString() }}">@icon('time'){{ $import->created_at->diffForHumans() }}</div>
+        <div class="bold opacity-80 text-muted min-width-xs text-right" title="{{ $dates->absolute($import->created_at) }}">@icon('time'){{ $dates->relative($import->created_at) }}</div>
     </div>
 </div>
\ No newline at end of file
index d4128898bc8dc8094d37fcd4c73945c1afd828b2..00117f4a157ae7c47064591f8811913fbd18d266 100644 (file)
@@ -4,13 +4,13 @@
     @endif
 
     @icon('star'){!! trans('entities.meta_created' . ($entity->createdBy ? '_name' : ''), [
-        'timeLength' => $entity->created_at->isoFormat('D MMMM Y HH:mm:ss'),
+        'timeLength' => $dates->absolute($entity->created_at),
         'user' => e($entity->createdBy->name ?? ''),
         ]) !!}
     <br>
 
     @icon('edit'){!! trans('entities.meta_updated' . ($entity->updatedBy ? '_name' : ''), [
-            'timeLength' => $entity->updated_at->isoFormat('D MMMM Y HH:mm:ss'),
+            'timeLength' => $dates->absolute($entity->updated_at),
             'user' => e($entity->updatedBy->name ?? '')
         ]) !!}
 </div>
\ No newline at end of file
index bd84e247d912d8b6a09d197f7e15082619fb98e4..452a0aaa1663cda0e6165ee90642fc75419bf4ef 100644 (file)
 
     <div class="text-muted text-small">
         <hr class="my-m">
-        <div title="{{ $image->created_at->format('Y-m-d H:i:s') }}">
-            @icon('star') {{ trans('components.image_uploaded', ['uploadedDate' => $image->created_at->diffForHumans()]) }}
+        <div title="{{ $dates->absolute($image->created_at) }}">
+            @icon('star') {{ trans('components.image_uploaded', ['uploadedDate' => $dates->relative($image->created_at)]) }}
         </div>
         @if($image->created_at->valueOf() !== $image->updated_at->valueOf())
-            <div title="{{ $image->updated_at->format('Y-m-d H:i:s') }}">
-                @icon('edit') {{ trans('components.image_updated', ['updateDate' => $image->updated_at->diffForHumans()]) }}
+            <div title="{{ $dates->absolute($image->updated_at) }}">
+                @icon('edit') {{ trans('components.image_updated', ['updateDate' => $dates->relative($image->updated_at)]) }}
             </div>
         @endif
         @if($image->createdBy)
index 48bea5b577c492a8b578fc62076e4656d72375e0..19b924763c366dcaace83792c825e17c0dda4e90 100644 (file)
@@ -17,8 +17,8 @@
                 @if($revision->createdBy) {{ $revision->createdBy->name }} @else {{ trans('common.deleted_user') }} @endif
                 <br>
                 <div class="text-muted">
-                    <small>{{ $revision->created_at->isoFormat('D MMMM Y HH:mm:ss') }}</small>
-                    <small>({{ $revision->created_at->diffForHumans() }})</small>
+                    <small>{{ $dates->absolute($revision->created_at) }}</small>
+                    <small>({{ $dates->relative($revision->created_at) }})</small>
                 </div>
             </div>
         </div>
index f2f70c14221b26d67e90aa9358ebbc7257547538..990583a710abb8437d86f5940e6a6e13a222c039 100644 (file)
@@ -6,7 +6,7 @@
          draggable="true" template-id="{{ $template->id }}">
         <div class="template-item-content" title="{{ trans('entities.templates_replace_content') }}">
             <div>{{ $template->name }}</div>
-            <div class="text-muted">{{ trans('entities.meta_updated', ['timeLength' => $template->updated_at->diffForHumans()]) }}</div>
+            <div class="text-muted" title="{{ $dates->absolute($template->updated_at) }}">{{ trans('entities.meta_updated', ['timeLength' => $dates->relative($template->updated_at)]) }}</div>
         </div>
         <div class="template-item-actions">
             <button type="button"
index 680fc1207b0d5cfadcdfef70d4ac83223fc94197..22d0c0183c2cb2c1d47b4ffff630c5c167529bd1 100644 (file)
                 <div>
                     <label class="setting-list-label">{{ trans('settings.webhooks_status') }}</label>
                     <p class="mb-none">
-                        {{ trans('settings.webhooks_last_called') }} {{ $webhook->last_called_at ? $webhook->last_called_at->diffForHumans() : trans('common.never') }}
+                        @if($webhook->last_called_at)
+                            <span title="{{ $dates->absolute($webhook->last_called_at) }}">{{ trans('settings.webhooks_last_called') }} {{  $dates->relative($webhook->last_called_at) }}</span>
+                        @else
+                            <span>{{ trans('settings.webhooks_last_called') }} {{ trans('common.never') }}</span>
+                        @endif
                         <br>
-                        {{ trans('settings.webhooks_last_errored') }} {{ $webhook->last_errored_at ? $webhook->last_errored_at->diffForHumans() : trans('common.never') }}
+                        @if($webhook->last_errored_at)
+                            <span title="{{ $dates->absolute($webhook->last_errored_at) }}">{{ trans('settings.webhooks_last_errored') }} {{  $dates->relative($webhook->last_errored_at) }}</span>
+                        @else
+                            <span>{{ trans('settings.webhooks_last_errored') }} {{ trans('common.never') }}</span>
+                        @endif
                     </p>
                 </div>
                 <div class="text-muted">
index aa3e49dedf8512e688fb46020c93d7313a39061c..3a1ff49d3c9f962e0e238662d6e32d40362ad5c0 100644 (file)
                 <div class="grid half gap-xl v-center">
 
                     <div class="text-muted text-small">
-                        <span title="{{ $token->created_at }}">
-                            {{ trans('settings.user_api_token_created', ['timeAgo' => $token->created_at->diffForHumans()]) }}
+                        <span title="{{ $dates->absolute($token->created_at) }}">
+                            {{ trans('settings.user_api_token_created', ['timeAgo' => $dates->relative($token->created_at)]) }}
                         </span>
                         <br>
-                        <span title="{{ $token->updated_at }}">
-                            {{ trans('settings.user_api_token_updated', ['timeAgo' => $token->created_at->diffForHumans()]) }}
+                        <span title="{{ $dates->absolute($token->updated_at) }}">
+                            {{ trans('settings.user_api_token_updated', ['timeAgo' => $dates->relative($token->created_at)]) }}
                         </span>
                     </div>
 
index dc7c9f272b813e79f827260168651e3fd4e95416..9c7ecd1476195e71174023068a3e35960173c1d8 100644 (file)
@@ -20,7 +20,7 @@
             @if($user->last_activity_at)
                 <small>{{ trans('settings.users_latest_activity') }}</small>
                 <br>
-                <small title="{{ $user->last_activity_at->format('Y-m-d H:i:s') }}">{{ $user->last_activity_at->diffForHumans() }}</small>
+                <small title="{{ $dates->absolute($user->last_activity_at) }}">{{ $dates->relative($user->last_activity_at) }}</small>
             @endif
         </div>
     </div>
index a8be8a4c19825a52835d7d2bce6f78472b5ae24a..9879091a5b98753c8030f100a455683478f66634 100644 (file)
@@ -23,7 +23,7 @@
                             <div>
                                 <h4 class="mt-md">{{ $user->name }}</h4>
                                 <p class="text-muted">
-                                    {{ trans('entities.profile_user_for_x', ['time' => $user->created_at->diffForHumans(null, true)]) }}
+                                    {{ trans('entities.profile_user_for_x', ['time' => $dates->relative($user->created_at, false)]) }}
                                 </p>
                             </div>
                         </div>
index 069cf2801677ae08ca3859cadd41bfade2fbec4d..e039fb2cc2bcd49dcbef8d00bb6fdc21d9f5c323 100644 (file)
@@ -99,9 +99,9 @@ class HtmlExportTest extends TestCase
         $page = $this->entities->page();
 
         $resp = $this->asEditor()->get($page->getUrl('/export/html'));
-        $resp->assertSee($page->created_at->isoFormat('D MMMM Y HH:mm:ss'));
+        $resp->assertSee($page->created_at->format('Y-m-d H:i:s T'));
         $resp->assertDontSee($page->created_at->diffForHumans());
-        $resp->assertSee($page->updated_at->isoFormat('D MMMM Y HH:mm:ss'));
+        $resp->assertSee($page->updated_at->format('Y-m-d H:i:s T'));
         $resp->assertDontSee($page->updated_at->diffForHumans());
     }
 
index c9004b5a570571374b83d4ef6c9f103e29653b97..1c0a458e078007278dadb89890cdbd6755dbc636 100644 (file)
@@ -13,7 +13,7 @@ class DateFormatterTest extends TestCase
         $formatter = new DateFormatter('Europe/London');
         $dateTime = new Carbon('2020-06-01 12:00:00', 'UTC');
 
-        $result = $formatter->isoWithTimezone($dateTime);
+        $result = $formatter->absolute($dateTime);
         $this->assertEquals('2020-06-01 13:00:00 BST', $result);
     }
 
@@ -22,7 +22,7 @@ class DateFormatterTest extends TestCase
         $formatter = new DateFormatter('Asia/Shanghai');
         $dateTime = new Carbon('2025-06-10 15:25:00', 'America/New_York');
 
-        $result = $formatter->isoWithTimezone($dateTime);
+        $result = $formatter->absolute($dateTime);
         $this->assertEquals('2025-06-11 03:25:00 CST', $result);
     }