davidhirtz/yii2-timeago

There is no license information available for the latest version (2.1.0) of this package.

Displays relative timestamps (e.g. "4 minutes ago" or "about 1 day ago") via a custom web component.

2.1.0 2024-12-26 09:19 UTC

This package is auto-updated.

Last update: 2024-12-26 09:20:42 UTC


README

Used to display auto-updating, translated relative dates (e.g. "3 minutes ago") HTML tags using a custom web component. For the previous version build on jQuery, use the version v1.2.0 constraint in your composer.json.

Installation

composer require davidhirtz/yii2-timeago "^2.1"

Usage

Once the extension is installed, simply use it in your view like this:

<?= \davidhirtz\yii2\timeago\Timeago::tag(time()); ?>

Or use the column helper class in your \yii\grid\GridView:

[
    'attribute' => 'created_at',
    'class' => \davidhirtz\yii2\timeago\TimeAgoColumn::class,
],