jmf/twig-time

Twig extension for handling date and time in Twig templates.

1.0.0 2024-06-05 16:04 UTC

This package is auto-updated.

Last update: 2024-12-05 17:12:54 UTC


README

Installation & Requirements

Install with Composer:

composer require jmf/twig-time

PHP intl extension is required if you need to use internationalized date formats.

Usage in Twig templates

microtime() function

Returns current microtime (timestamp with milli/microseconds)

{% set now = microtime() %}

intl_format() filter

Formats provided IntlCalendar / DateTime object with internationalization.

See https://unicode-org.github.io/icu/userguide/format_parse/datetime/#datetime-format-syntax for available formatting tokens.

{{ date|intl_format('cccc', 'fr_CA.UTF-8') }}