Event Calendar Public Date/Time. But sometimes no time

Permalink
Hi there,
I have a calendar of events that my clients uses.

It is created by a page list block with custom attributes.

The clients adds the date and time in the default "Public date and time" area but sometimes the client does not have a time. Is there anyway of not displaying the time but keeping the date in some instances?

dancer
 
ScottC replied on at Permalink Reply
ScottC
not really. You could add a collection attribute checkbox with something like(dont_show_time) as Handle and Name being whatever you want, then

$yourPageObject;
if($yourPageObject->getCollectionAttribute('dont_show_time')){
$dateCalendarDisplay = date("m/d/Y",strtotime($yourPageObject->getCollectionDatePublic()));
}else{
$dateCalendarDisplay = date('m/d/Y g:ia',strtotime($yourPageObject->getCollectionDatePublic()));
}


assuming you are using your days as some sort of array key lookup of some sort to pick where to show your days in your calendar.

There is a $dh = new DateHelper(); $dh->date instead of $dh->dateTime but that isn't something you can change without creating a new collection attribute, in that case it would only be one small change in the form.

That should get you started.