Skip to content

Commit ecc10d3

Browse files
committed
Document format_translated modifier
Added in statamic/cms#4272.
1 parent ab43b14 commit ecc10d3

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
id: 8cbea367-799f-4fb6-866e-519d571f7b3e
3+
blueprint: modifiers
4+
modifier_types:
5+
- date
6+
- string
7+
title: 'Format Translated'
8+
---
9+
Given a date string, or anything that sort of looks like a date string, `format_translated` will convert it to a [Carbon][carbon] instance and allow you to format it using your site's configured locale.
10+
11+
```yaml
12+
event_date: 2024-02-28
13+
```
14+
15+
::tabs
16+
17+
::tab antlers
18+
```antlers
19+
{{ event_date | format_translated('l j F Y') }}
20+
```
21+
::tab blade
22+
```blade
23+
{{ Statamic::modify($event_date)->format_translated('l j F Y') }}
24+
```
25+
::
26+
27+
Assuming your site's locale is `fr_FR`:
28+
29+
```html
30+
mercredi 28 février 2024
31+
```
32+
33+
[carbon]: http://carbon.nesbot.com

0 commit comments

Comments
 (0)