Skip to content

MDXDave/time-ago

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TimeAgo plugin for Craft CMS 4.x

Displays time ago for a given timestamp value within a Craftcms3 Twig template.

Requirements

This plugin requires Craft CMS 4.0.0 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require mdxdave/time-ago
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for TimeAgo.

Using TimeAgo

Just use the following code in your Twig template file:

    {{ entry.postDate.getTimestamp()|timeAgo }}

If you want to use another language than english, use:

    {{ entry.postDate.getTimestamp()|timeAgo("de") }}

Brought to you by MDXDave