2017 © Pedro Peláez
 

yii2-extension yii2-timeago

Yii2 extension for jQuery plugin timeago which makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago") from ISO 8601 formatted dates and times embedded in your HTML (à la microformats).

image

davidhirtz/yii2-timeago

Yii2 extension for jQuery plugin timeago which makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago") from ISO 8601 formatted dates and times embedded in your HTML (à la microformats).

  • Monday, November 27, 2017
  • by davidhirtz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5,463 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 10 % Grown

The README.md

Yii2 jQuery Timeago Plugin

Yii2 extension for jQuery plugin timeago which makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago") from ISO 8601 formatted dates and times embedded in your HTML (à la microformats)., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist davidhirtz/yii2-timeago "*"

or add, (*4)

"davidhirtz/yii2-timeago": "*"

to the require section of your composer.json file., (*5)

Usage

Once the extension is installed, simply use it in your view like this:, (*6)

<?php \davidhirtz\yii2\timeago\TimeagoAsset::register($this); ?>

Additional options:, (*7)

'assetManager'=>[
    'bundles'=>[
        'davidhirtz\yii2\timeago\TimeagoAsset'=>[
            // Load localized version based on Yii::$app->language. Default true.
            'locale'=>true,
            // Use short locale version if available. Default false.
            'short'=>false,
            // Plugin options, see plugin website for details. Default values below.
            'settings'=>[
                'refreshMillis'=>60000,
                'allowPast'=>true,
                'allowFuture'=>false,
                'localeTitle'=>false,
                'cutoff'=>0,
                'autoDispose'=>true,
                // Strings set here it will overwrite loaded locale config.
                'strings'=>[
                    'prefixAgo'=>null,
                    'prefixFromNow'=>null,
                    'suffixAgo'=>"ago",
                    'suffixFromNow'=>"from now",
                    'inPast'=>'any moment now',
                    'seconds'=>"less than a minute",
                    'minute'=>"about a minute",
                    'minutes'=>"%d minutes",
                    'hour'=>"about an hour",
                    'hours'=>"about %d hours",
                    'day'=>"a day",
                    'days'=>"%d days",
                    'month'=>"about a month",
                    'months'=>"%d months",
                    'year'=>"about a year",
                    'years'=>"%d years",
                    'wordSeparator'=>" ",
                    'numbers'=>[],
                ],
            ],
        ],
    ],
],

The Versions

27/11 2017

dev-master

9999999-dev

Yii2 extension for jQuery plugin timeago which makes it easy to support automatically updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago") from ISO 8601 formatted dates and times embedded in your HTML (à la microformats).

  Sources   Download

MIT

The Requires

 

by David Hirtz

yii2 extension time jquery timeago microtime