Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

Get translated day of week error

Started by Artyom 9 years ago · 1 replies · 629 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 blu3prince, 3 days ago
1 65 42 minutes ago
Support · by complanar, 6 days ago
6 156 1 day ago
Support · by Rick Beebe, 7 days ago
2 114 3 days ago
Support · by alex, 5 days ago
2 100 4 days ago
Support · by Marcel, 2 weeks ago
1 151 4 days ago