Bring Twig Date extension to your Craft3 CMS.
Plugins should be normaly installed via Craf3 Plugin manager, but as the plugin was not intendet to be shared, it was added as DEV-plugin to my project at the time. So, to implement it, you'll have to do the same.
- Copy the files to the root document of your Craft3 installation
- Open your Craft3 composer.json
- Add the following above "require" ( where "../timedif" is path to the plugin directory ):
"repositories": [
{
"type": "path",
"url": "../timediff"
}
]
- In your terminal, go to your Craft project and tell Composer to require your plugin.
composer require mishellnovosel/craft3_timediff
Renders the difference between a date and now:
{{ post.published_at|time_diff }}
- Outputs "1 day ago" or "in 5 months"