Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

Get translated day of week error

Started by Artyom 9 years ago · 1 replies · 674 views
9 years ago

Found a bug with this recipe: {{ 'DAYS_OF_THE_WEEK'|ta(post.date|date('w') - 1) }} when the day is Sunday. post.date|date('w') is equal 0 and minus 1 becomes -1 and I see this on my page: DAYS_OF_THE_WEEK[-1]

How to fix it?

9 years ago

Solved by: {{ 'DAYS_OF_THE_WEEK'|ta(post.date|date('N') - 1) }}

Suggested topics

Topic Participants Replies Views Activity
Support · by webmasterodp, 7 days ago
4 145 6 days ago
Support · by nwhitfield, 1 week ago
2 124 1 week ago
Support · by stell, 3 weeks ago
5 364 2 weeks ago
Support · by gravinator, 1 month ago
5 555 2 weeks ago
Support · by Gravver, 3 weeks ago
6 344 3 weeks ago