Fix the date output.
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 4 Apr 2019 13:31:09 +0000 (09:31 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 4 Apr 2019 13:31:09 +0000 (09:31 -0400)
Deal with date output when to show the day of week in the date output.

views/front/events/detail.html

index d10d528..be2f4e8 100755 (executable)
                             {$lastDate = ''}
                             {foreach $event.recurrences as $rec}
 
-                                {$eDate = $rec.from_date.timestamp|date_format:"%A, %B %e, %Y"}
+                                {$showDayOfWeek = true}
+                                {* Don't show the day of week if there's specific_dates or if recurDays has value *}
+                                {if trim($event.recurDays) == '' && count($rec.specific_dates) > 0}
+                                    {$showDayOfWeek = false}
+                                {/if}
+                                {* Don't show the day of the week if there's day of week added to end *}
+                                {if $rec.day_of_week.names|@count < 7 && $rec.day_of_week.names|@count > 0}
+                                    {$showDayOfWeek = false}
+                                {/if}
+
+                                {if $showDayOfWeek}
+                                    {$eDate = $rec.from_date.timestamp|date_format:"%A, %B %e, %Y"}
+                                {else}
+                                    {$eDate = $rec.from_date.timestamp|date_format:"%B %e, %Y"}
+                                {/if}
                                 {if $eDate != $lastDate}
                                     {$lastDate = $eDate}
                                     <div class="glm-event-date">
                                         <span class="date-tag"></span>
                                         <span class="glm-date-display">
-                                    {if $event.recurrences.0.recurring.value == 1} Occurring {/if}
+                                    {if $rec.recurring.value == 1} Occurring {/if}
 
-                                    {$eDate}
+                                        {$eDate}
                                         {if $rec.from_date.date != $rec.to_date.date}
                                             - {$rec.to_date.timestamp|date_format:"%B %e, %Y"}
                                         {else if $rec.specific_dates}