I’m trying to display a badge depending on a selected date range. I have created two date TVs, badgeStart and badgeEnd, and installed the snippet getDate.
If I just output their values in my chunk all looks fine. This code:
Now date: [[!getDate:date=`%Y%m%d`]]<br>
Start date: [[+tv.badgeStart:date=`%Y%m%d`]]<br>
End date: [[+tv.badgeEnd:date=`%Y%m%d`]]<br>
Returns this:
Now date: 20230707
Start date: 20230706
End date: 20231231
However, this code won’t display the text “Show Badge” for some reason.
[[+tv.badgeStart:date=`%Y%m%d`:lt=`[[!getDate:date=`%Y%m%d`]]`:then=`
[[+tv.badgeEnd:date=`%Y%m%d`:gt=`[[!getDate:date=`%Y%m%d`]]`:then=`
Show Badge
`:else=``]]
`:else=``]]
I’m using MODX 3.0.4-dev and PHP 8.2.7.