Skip to content

Commit 5dbb9f1

Browse files
committed
Dates older than 7 days should be displayed in absolute form
1 parent 01a64a6 commit 5dbb9f1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

app/Support/helpers.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,8 @@ class="form-control"
5353
</div>
5454
</div>
5555
<?php
56-
}
56+
}
57+
58+
function note_creation_date(Carbon\Carbon $date) {
59+
return $date->diffInDays() > 7 ? $date->format(trans('app.date')) : $date->diffForHumans();
60+
}

resources/views/note/single.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<a href="{!! route('note', ['id' => $note->id]) !!}"
2121
data-toggle="tooltip"
2222
title="{{ $note->created_at->format(trans('app.datetime')) }}">
23-
@icon('clock-o') {{ $note->created_at->diffForHumans() }}
23+
@icon('clock-o') {{ note_creation_date($note->created_at) }}
2424
</a>
2525
@if ($state != 'default' && $state != 'success')
2626
<span class="note-expired">

0 commit comments

Comments
 (0)