Date

Format a date

Returns formatted date

Returns a globally set format of a date

<time class="2020-01-01 17:25">Wed 01 Jan 2020</time>
@date([
    'action' => 'formatDate',
    'timestamp' => '2020-01-01 17:25:43'
])
@enddate

Time Since

Returns time since a specified date

Returns the time since a given date

<span 
        id="62beda05a5c9f" 
    class="c-tooltip c-tooltip__top"
    js-bind-hover="tooltip" data-title="Wed 01 Jan 2020" role="tooltip" aria-label="Tooltip: Wed 01 Jan 2020" data-uid="62beda05a5c99"
    >
     <time class="2020-01-01 17:25">2 year</time> 
</span>
@date([
    'action' => 'timesince',
    'timestamp' => '2020-01-01 17:25:43'
])
@enddate

Time Since [With translations]

Returns time since a specified date

Returns the time since a given date

<div>
  <span 
        id="62beda05a6123" 
    class="c-tooltip c-tooltip__top"
    js-bind-hover="tooltip" data-title="Wed 01 Jan 2020" role="tooltip" aria-label="Tooltip: Wed 01 Jan 2020" data-uid="62beda05a611d"
    >
     <time class="2020-01-01 17:25">2 år</time> 
</span>
</div>

<div>
  <span 
        id="62beda05a61ef" 
    class="c-tooltip c-tooltip__top"
    js-bind-hover="tooltip" data-title="Fri 01 Jul 2022" role="tooltip" aria-label="Tooltip: Fri 01 Jul 2022" data-uid="62beda05a61ec"
    >
     <time class="2022-07-01 13:27">1 sekund</time> 
</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

Returns time until a specified date

<span 
        id="62beda05a6457" 
    class="c-tooltip c-tooltip__top"
    js-bind-hover="tooltip" data-title="Wed 06 Jul 2022" role="tooltip" aria-label="Tooltip: Wed 06 Jul 2022" data-uid="62beda05a6454"
    >
     <time class="2022-07-06 00:00">4 day</time> 
</span>
@date([
    'action' => 'timeuntil',
    'timestamp' => date('Y-m-d', strtotime(' + 5 days'))
])
@enddate

Blade component parameters

Key Default value Type Available values Description
date 24/12/2019 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
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
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.
Settings location: /mnt/persist/www/docroot_styleguide_v2/source/library/source/php/Component/Date/date.json