Date
Format a date
Returns formatted date
<time class="2020-01-01T17:25:43 c-date" data-uid="673ed20fb3f39">Wed 01 Jan 2020 </time>
@date([
'action' => 'formatDate',
'timestamp' => '2020-01-01 17:25:43'
])
@enddate
Time Since
Returns time since a specified date
4 year
<span class="c-tooltip c-tooltip--top c-tooltip--hidden" original-placement="c-tooltip--top" id="673ed20fb3ffb" data-uid="673ed20fb3ffb">
<div class="c-tooltip__wrapper" tabindex="1" aria-describedby="673ed20fb3ffb">
<!-- typography.blade.php original: strong -->
<strong class="c-typography u-margin__right--1 c-typography__variant--strong" data-uid="673ed20fb4048">
4 year
</strong> <div class="c-tooltip__container" aria-hidden="true" role="tooltip" id="673ed20fb3ffb">
<div class="c-tooltip__content">
<time class="2020-01-01T17:25:43 c-date" data-uid="673ed20fb3fb0">Wed 01 Jan 2020</time>
</div>
<span class="c-tooltip__arrow"></span>
</div>
</div>
</span>
@date([
'action' => 'timesince',
'timestamp' => '2020-01-01 17:25:43'
])
@enddate
Time Since [With translations]
Returns time since a specified date
4 år
just now
<div>
<span class="c-tooltip c-tooltip--top c-tooltip--hidden" original-placement="c-tooltip--top" id="673ed20fb40d5" data-uid="673ed20fb40d5">
<div class="c-tooltip__wrapper" tabindex="1" aria-describedby="673ed20fb40d5">
<!-- typography.blade.php original: strong -->
<strong class="c-typography u-margin__right--1 c-typography__variant--strong" data-uid="673ed20fb4100">
4 år
</strong> <div class="c-tooltip__container" aria-hidden="true" role="tooltip" id="673ed20fb40d5">
<div class="c-tooltip__content">
<time class="2020-01-01T17:25:43 c-date" data-uid="673ed20fb40b0">Wed 01 Jan 2020</time>
</div>
<span class="c-tooltip__arrow"></span>
</div>
</div>
</span>
</div>
<div>
<span class="c-tooltip c-tooltip--top c-tooltip--hidden" original-placement="c-tooltip--top" id="673ed20fb4158" data-uid="673ed20fb4158">
<div class="c-tooltip__wrapper" tabindex="1" aria-describedby="673ed20fb4158">
<!-- typography.blade.php original: strong -->
<strong class="c-typography u-margin__right--1 c-typography__variant--strong" data-uid="673ed20fb4182">
just now
</strong> <div class="c-tooltip__container" aria-hidden="true" role="tooltip" id="673ed20fb4158">
<div class="c-tooltip__content">
<time class="2024-11-21T06:24:15 c-date" data-uid="673ed20fb4136">Thu 21 Nov 2024</time>
</div>
<span class="c-tooltip__arrow"></span>
</div>
</div>
</span>
</div>
<div>
@date([
'action' => 'timesince',
'timestamp' => '2020-01-01 17:25:43',
'labels' => [
'year' => 'år',
'month' => 'månad',
'week' => 'vecka',
'day' => 'dag',
'hour' => 'timme',
'minute' => 'minut',
'second' => 'sekund'
],
'labelsPlural' => [
'year' => 'år',
'month' => 'månader',
'week' => 'veckor',
'day' => 'dagar',
'hour' => 'timmar',
'minute' => 'minuter',
'second' => 'sekund'
]
])
@enddate
</div>
<div>
@date([
'action' => 'timesince',
'timestamp' => date("Y-m-d H:i:s"), //'2020-01-01 17:25:43',
'labels' => [
'year' => 'år',
'month' => 'månad',
'week' => 'vecka',
'day' => 'dag',
'hour' => 'timme',
'minute' => 'minut',
'second' => 'sekund'
],
'labelsPlural' => [
'year' => 'år',
'month' => 'månader',
'week' => 'veckor',
'day' => 'dagar',
'hour' => 'timmar',
'minute' => 'minuter',
'second' => 'sekund'
]
])
@enddate
</div>
Time Until
Returns time until a specified date
<time class="2024-11-26T00:00:00 c-date" data-uid="673ed20fb41f9">Tue 26 Nov 2024 </time>
@date([
'action' => 'timeuntil',
'timestamp' => date('Y-m-d', strtotime(' + 5 days'))
])
@enddate
Blade component parameters
Key | Default value | Type | Available values | Description |
timestamp | string | - | The date | |
time_since | false | boolean | - | Will return the date since. |
time_since_cap | 6 months | string | - | How long back to spell out time since |
format | D d M Y | string | - | Present date's in this format. Default: D d M Y |
action | formatDate | string | - | What to do with the inputted date: formatDate, timesince, timeuntil. Can be false to just output the timestamp. |
labels | [] | array | - | Array containing translations valid keys: year, month, week, day, hour, minute, second |
labelsPlural | [] | array | - | Array containing translations valid keys: year, month, week, day, hour, minute, second |
timeSinceSuffix | ago | string | - | Suffix for the time since label |
nowLabel | just now | string | - | What to show when the date is considered to be in the present |
timeNowCap | 60 | integer | - | How many seconds back to show 'nowLabel' |
id | string | - | The DOM id of the component. | |
classList | [] | array | - | Array containing wrapping classes array |
attributeList | [] | array | - | Array containing keys and values rendered as attributes |
containerAware | false | boolean | true/false | Makes the component container aware. Appends modifiers --size--xs/sm/md/lg to the component. |