Skip to content

Commit 63d7062

Browse files
committed
Make dates a little more user friendly
1 parent 449324f commit 63d7062

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

resources/views/server/files/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<h3 class="panel-title">File Path Information</h3>
5252
</div>
5353
<div class="panel-body">
54-
When configuring any file paths in your server plugins or settings you should use <code>/home/container</code> as your base path. While your SFTP client sees the files as <code>/public</code> this is not true for the server process.
54+
When configuring any file paths in your server plugins or settings you should use <code>/home/container</code> as your base path.
5555
</div>
5656
</div>
5757
</div>

resources/views/server/files/list.blade.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,16 @@
6363
<a href="/server/{{ $server->uuidShort }}/files" data-action="directory-view">{{ $folder['entry'] }}</a>
6464
</td>
6565
<td data-identifier="size">{{ $folder['size'] }}</td>
66-
<td data-identifier="modified">{{ date('m/d/y H:i:s', $folder['date']) }}</td>
66+
<td data-identifier="modified">
67+
<?php $carbon = Carbon::createFromTimestamp($folder['date'])->timezone(env('APP_TIMEZONE', 'America/New_York')); ?>
68+
@if($carbon->diffInMinutes(Carbon::now()) > 60)
69+
{{ $carbon->format('m/d/y H:i:s') }}
70+
@elseif($carbon->diffInSeconds(Carbon::now()) < 5 || $carbon->isFuture())
71+
<em>seconds ago</em>
72+
@else
73+
{{ $carbon->diffForHumans() }}
74+
@endif
75+
</td>
6776
</tr>
6877
@endforeach
6978
@foreach ($files as $file)
@@ -130,7 +139,16 @@
130139
@endif
131140
</td>
132141
<td data-identifier="size">{{ $file['size'] }}</td>
133-
<td data-identifier="modified">{{ date('m/d/y H:i:s', $file['date']) }}</td>
142+
<td data-identifier="modified">
143+
<?php $carbon = Carbon::createFromTimestamp($file['date'])->timezone(env('APP_TIMEZONE', 'America/New_York')); ?>
144+
@if($carbon->diffInMinutes(Carbon::now()) > 60)
145+
{{ $carbon->format('m/d/y H:i:s') }}
146+
@elseif($carbon->diffInSeconds(Carbon::now()) < 5 || $carbon->isFuture())
147+
<em>seconds ago</em>
148+
@else
149+
{{ $carbon->diffForHumans() }}
150+
@endif
151+
</td>
134152
</tr>
135153
@endforeach
136154
</tbody>

0 commit comments

Comments
 (0)