Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Conditional Event date display
Hello community,
I search a calendar dates manipulating system
I use <txp:posted />
and <txp:expires />
for display dates of events.
I want display the events dates in diff. formats.
If ( posted{2013-12-17} == expires{2013-12-17} ) // Same day
display
17 dec 2013
If ( posted{2013-12-17} < expires{2013-12-20} && posted{month} == expires{month} ) // max diff. 3 days
display
17 - 18 - 19 dec 2013
if ( posted{2013-12-17} < expires{2014-01-12} // sup 3 days or diff month
display
17 dec 2013 -> 12 jan 2013
I think I’m looking for a tool that returns the number of days between two dates and the number of each days.
A idea ? Thanks
Last edited by sacripant (2013-12-17 19:38:46)
Offline
Re: Conditional Event date display
I don’t have an answer for you, but I am pretty confident Oleg ‘etc’ will be here in very soon with a way that etc_query
can do exactly what you want.
Offline
Re: Conditional Event date display
Sacripant, a long time ago, Ruud helped me out with something similar, although the source was dates held in custom fields and the equivalent to your “same month” date display was a bit more succinct. See this post and the comments that follow.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Conditional Event date display
gaekwad wrote:
I don’t have an answer for you, but I am pretty confident Oleg ‘etc’ will be here in very soon with a way that
etc_query
can do exactly what you want.
We are selling light weapons too, try this:
<txp:etc_if_date date="expires" compare="posted" format="%Y-%m">
<txp:etc_if_date date="expires" compare="posted +1 day.." format="%d">
<txp:posted format="%d" /> -
</txp:etc_if_date>
<txp:etc_if_date date="expires" compare="posted +2 days..posted +3 days" format="%d">
<txp:etc_date date="posted +1 days" format="%d" /> -
</txp:etc_if_date>
<txp:etc_if_date date="expires" compare="posted +3 days" format="%d">
<txp:etc_date date="posted +2 days" format="%d" /> -
</txp:etc_if_date>
<txp:expires />
<txp:else />
<txp:posted /> - <txp:expires />
</txp:etc_if_date>
Offline
Offline
Pages: 1