eschmar/time-ago-bundle
最新稳定版本:v2.0.1
Composer 安装命令:
composer require eschmar/time-ago-bundle
包简介
Provides a simple twig filter for expressing time difference in words.
README 文档
README
Provides a simple twig filter for expressing time difference in words for Symfony. Uses a range of +-7 days, after that, the actual date is returned.
Install
Composer (Packagist):
composer require eschmar/time-ago-bundle ^v2.0.0 # Symfony ^5.0
or for older symfony versions:
composer require eschmar/time-ago-bundle ^v1.1.0 # Symfony ^4.x composer require eschmar/time-ago-bundle ~v0.4.0 # Symfony ^2.8 composer require eschmar/time-ago-bundle ~v0.5.0 # Symfony ^3.4
app/Appkernel.php (Symfony <4):
new Eschmar\TimeAgoBundle\EschmarTimeAgoBundle(),
Usage
{{ date('now')|ago }}
{# just now #}
{{ date('now').modify('-3 minutes')|ago }}
{# 3 minutes ago #}
{{ date('now').modify('-3 months')|ago('r') }}
{# actual date in 'r' format #}
{{ date('now').modify('+4 hours')|ago('r') }}
{# in 4 hours #}
Change default format in config.yml:
eschmar_time_ago: format: 'Y-m-d H:i:s'
Translations available
- Belarusian
- Croatian
- Czech
- Danish
- Dutch
- English
- French
- Finnish
- German
- Hindi
- Hungarian
- Indonesian
- Italian
- Malay
- Norwegian
- Polish
- Portuguese (Brazil)
- Romanian
- Russian
- Slovenian
- Spanish
- Swedish
- Tagalog
- Turkish
- Ukranian
- Vietnamese
License
MIT License
统计信息
- 总下载量: 50.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-04