From df285a6f002065ee7ce651895c6fa627eabeb3c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 16 Dec 2025 10:19:45 +0100 Subject: [PATCH 1/4] Added mention about the date filters --- .../date_twig_filters.md | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/templating/twig_function_reference/date_twig_filters.md b/docs/templating/twig_function_reference/date_twig_filters.md index 64b4e88b46..88cfab623f 100644 --- a/docs/templating/twig_function_reference/date_twig_filters.md +++ b/docs/templating/twig_function_reference/date_twig_filters.md @@ -25,3 +25,33 @@ The filters also accept an optional `timezone` parameter for displaying date and ``` html+twig {{ content.contentInfo.publishedDate|ibexa_short_datetime('PST') }} ``` + +## Considerations for usage outside back office + +The filters rely on user preferences. +When the preferences are not set, for example for logged out users, the filters fallback to a default date format. +In case of some filters, the fallback date format contains locale-aware fragments, for example: full name of the month or day. +When combined with [reverse proxies like Varnish or Fastly](http_cache.md), it's possible to cache a localized version of a date and display it to other users, even if they're not using the same locale. + +Consider these alternatives: + +- Use Twig's built-in `date` filter with a fixed, locale-indenepdent format + + ``` html+twig + {{ content.contentInfo.publishedDate|date('Y-m-d H:i:s') }} + ``` + +- Use ESI for dynamic rendering of the date + + ``` html+twig + {{ render_esi(controller('App\\Controller\\CustomDateController::format', { + 'date': content.contentInfo.publishedDate + })) }} + ``` + + Don't cache the ESI response. + By implementing this solution, you can keep the date format locale-aware. + +- Client-side JavaScript formatting + +For more information, see [HTTP Cache](http_cache.md) and [Delivering personalized responses](context_aware_cache.md#personalize-responses). From 51ab23863c13145452c73516ce8e721e42a387ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Wed, 17 Dec 2025 11:45:35 +0100 Subject: [PATCH 2/4] Update docs/templating/twig_function_reference/date_twig_filters.md Co-authored-by: Konrad Oboza --- docs/templating/twig_function_reference/date_twig_filters.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/templating/twig_function_reference/date_twig_filters.md b/docs/templating/twig_function_reference/date_twig_filters.md index 88cfab623f..622bc96ffe 100644 --- a/docs/templating/twig_function_reference/date_twig_filters.md +++ b/docs/templating/twig_function_reference/date_twig_filters.md @@ -35,7 +35,7 @@ When combined with [reverse proxies like Varnish or Fastly](http_cache.md), it's Consider these alternatives: -- Use Twig's built-in `date` filter with a fixed, locale-indenepdent format +- Use Twig's built-in `date` filter with a fixed, locale-independent format ``` html+twig {{ content.contentInfo.publishedDate|date('Y-m-d H:i:s') }} From 02220adef108eeee0e9e02f41bf4325974a050dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Mon, 19 Jan 2026 11:45:18 +0100 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: julitafalcondusza <117284672+julitafalcondusza@users.noreply.github.com> --- .../templating/twig_function_reference/date_twig_filters.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/templating/twig_function_reference/date_twig_filters.md b/docs/templating/twig_function_reference/date_twig_filters.md index 622bc96ffe..f5950df455 100644 --- a/docs/templating/twig_function_reference/date_twig_filters.md +++ b/docs/templating/twig_function_reference/date_twig_filters.md @@ -26,11 +26,11 @@ The filters also accept an optional `timezone` parameter for displaying date and {{ content.contentInfo.publishedDate|ibexa_short_datetime('PST') }} ``` -## Considerations for usage outside back office +## Considerations for use outside the back office The filters rely on user preferences. -When the preferences are not set, for example for logged out users, the filters fallback to a default date format. -In case of some filters, the fallback date format contains locale-aware fragments, for example: full name of the month or day. +When the preferences are not set, for example, for logged out users, the filters fallback to a default date format. +For some filters, the fallback date format includes locale-aware fragments, such as the full month or day name. When combined with [reverse proxies like Varnish or Fastly](http_cache.md), it's possible to cache a localized version of a date and display it to other users, even if they're not using the same locale. Consider these alternatives: From c3f5322a47ffac1d03be18e5266496b30c88486e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 20 Jan 2026 12:34:16 +0100 Subject: [PATCH 4/4] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Tomasz Dąbrowski <64841871+dabrt@users.noreply.github.com> Co-authored-by: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> --- .../twig_function_reference/date_twig_filters.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/templating/twig_function_reference/date_twig_filters.md b/docs/templating/twig_function_reference/date_twig_filters.md index f5950df455..42a27e4f19 100644 --- a/docs/templating/twig_function_reference/date_twig_filters.md +++ b/docs/templating/twig_function_reference/date_twig_filters.md @@ -29,7 +29,7 @@ The filters also accept an optional `timezone` parameter for displaying date and ## Considerations for use outside the back office The filters rely on user preferences. -When the preferences are not set, for example, for logged out users, the filters fallback to a default date format. +When the preferences are not set, for example, for logged out users, the filters fall back to a default date format. For some filters, the fallback date format includes locale-aware fragments, such as the full month or day name. When combined with [reverse proxies like Varnish or Fastly](http_cache.md), it's possible to cache a localized version of a date and display it to other users, even if they're not using the same locale. @@ -54,4 +54,17 @@ Consider these alternatives: - Client-side JavaScript formatting + ``` html+twig + {{ content.contentInfo.publishedDate|date('Y-m-d H:i:s') }} + … + + ``` + For more information, see [HTTP Cache](http_cache.md) and [Delivering personalized responses](context_aware_cache.md#personalize-responses).