Tuesday 29 July 2008 10:37:21 am
This is driving me nuts so any help would be much appreciated.
I use the same if statement in two places on my site. The basic goal of the statement is as follows: If the event start date and the event end date are not the same and the event end date has content then show format the date field in the following way else format it another way without the end date. Here is the statement I am using:
{if and(ne($event.data_map.start_date.content.timestamp,$event.data_map.end_date.content.timestamp),$event.data_map.end_date.content.timestamp)}
{def $event_date = concat($event.data_map.start_date.content.timestamp|datetime( 'custom', '%M %d, %Y' ),' - ',$event.data_map.end_date.content.timestamp|datetime( 'custom', '%M %d, %Y' ))}
{else}
{def $event_date = $event.data_map.start_date.content.timestamp|datetime( 'custom', '%M %d, %Y' )}
{/if}
When I run this code in my regular templates it works as expected. However I use the same code on the same event list in a pdf template and it does not work correctly. Blank dates are getting through as having content. Inside the pdf I am getting dec 31, 1969 as an end date for events that did not have an end date entered. Using attribute show I can see that the start timestamp has value, the end timestamp comes out as 0 and has_content appears as false but it still goes inside this if statement for some reason. Have I stumbled upon a strange bug? Is there any reason an if statement would behave differently inside a pdf template?
working at www.wardnet.com
blogging at www.jamesward.ca
|