Skip to content

Commit

Permalink
update generateDate
Browse files Browse the repository at this point in the history
  • Loading branch information
zafranf committed Nov 8, 2020
1 parent 1a850e2 commit 04a2af0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ public function scopeWithAuthor($query, $name)

public function getPublishedStringAttribute()
{
return generateDate($this->published_at, app('site')->language, 'Do MMMM YYYY HH:mm');
return generateDate($this->published_at, 'Do MMMM YYYY HH:mm');
}
}
3 changes: 2 additions & 1 deletion src/app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,9 @@ function generateBreadcrumb($breadcrumbs, $with_date = true)
* @param [type] $lang [description]
* @return [type] [description]
*/
function generateDate($date = null, string $lang = 'id', string $format = null)
function generateDate($date = null, string $format = null, $lang = null)
{
$lang = $lang ?? (app('user')->lang ?? app('site')->lang);
if (is_null($format)) {
$format = ($lang == 'id') ? 'dddd, Do MMMM YYYY' : 'dddd, MMMM Do YYYY';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<div class="row">
<div class="col-md-1">Waktu</div>
<div class="col-md-11">{{ generateDate($data->created_at,'id', 'dddd, Do MMMM YYYY HH:mm') }}</div>
<div class="col-md-11">{{ generateDate($data->created_at, 'dddd, Do MMMM YYYY HH:mm') }}</div>
</div>
<div class="row">
<div class="col-md-1">Subjek</div>
Expand Down
2 changes: 1 addition & 1 deletion src/resources/views/AdminSC/report/inbox_detail.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</div>
<div class="row">
<div class="col-md-1">Waktu</div>
<div class="col-md-11">{{ generateDate($data->created_at,'id', 'dddd, Do MMMM YYYY HH:mm') }}</div>
<div class="col-md-11">{{ generateDate($data->created_at, 'dddd, Do MMMM YYYY HH:mm') }}</div>
</div>
<div class="row">
<div class="col-md-1">Subjek</div>
Expand Down

0 comments on commit 04a2af0

Please sign in to comment.