Support

Home Forums Event Espresso Premium Date-Time formatting for multi day events

Date-Time formatting for multi day events

Posted: August 25, 2015 at 6:10 am

Viewing 16 reply threads


Alan Lewis

August 25, 2015 at 6:10 am

Is there a way of formatting the date-times differently for multi day events.

Currently for a event spanning several days, beginning May 11, 2016 at 6pm and finishing on May 15, 2016 at 2pm it is reading thus on the event:

May 11, 2016 – May 15, 2016
6:00 pm – 2:00 pm

The times here, are getting visually disconnected from the dates

This looks really strange – May 11, 2016 – May 15, 2016 is fine
but what is the end-user to make of 6:00 pm – 2:00 pm??? it looks really strange, like time is going backwards.

Can it be made to show

May 11, 2016 at 6:00 pm – May 15, 2016 at 2:00 pm?

Any suggestions?

Example here


https://bodhi-institute.org/events/verkehrtheiten-und-die-befreiung-des-herzens-vipallasa-vimokkha
</p>


Tony

  • Support Staff

August 25, 2015 at 6:26 am

Hi Alan,

That event is password protected so we can’t see it currently.

However I’m guessing you are referring to the datetime list here – http://take.ms/L5BxN


Alan Lewis

August 25, 2015 at 6:49 am

Hi Tony

Exactly that – I forgot my event is private but this is a screenshot


https://bodhi-institute.org/wp-content/uploads/25-08-15-13-44-22.jpg </p>

In your example it looks like the event is happening between 8am-5pm each day between 27th and 29th

My event is a residential meditation retreat where people are arriving May 11, 2016 at 6pm and the retreat concludes at 2pm on May 15, 2016

However the way that EE renders it is completely wrong. Can this be fixed using CSS maybe?


Alan Lewis

August 25, 2015 at 12:03 pm

I found my answer here

https://eventespresso.com/topic/how-to-customize-date-range-displays

Bev Hoernig’s solution at the bottom gives the formatting as

March 5, 2016 12:00 pm – August 9, 2017 12:00 pm – which is ideal


Tony

  • Support Staff

August 25, 2015 at 12:19 pm

Apologies for the delay, I’m glad you’ve found a solution.

I’m assuming you’ve added that to your themes functions.php file or a Site Specific Plugin so it isn’t lost on updates?


Alan Lewis

August 25, 2015 at 12:53 pm

thanks – I added it to a plugin, however on a German version of the site it converts the month names to English unfortunately

Any idea what i might tweak to avoid this?


Josh

  • Support Staff

August 26, 2015 at 1:32 pm

Hi Alan,

Can you let me know which month names get translated to English on your site? I checked a site I have set up with the German language and added your code to reformat the dates and it turns out the month names are printed in German.


Alan Lewis

August 31, 2015 at 5:41 am

Hi Josh – I noticed that when the event was using the German month “Mai”, the English translation “May” was used – and this seemed to happen for all events. What code did you use? Maybe I could try that instead…


Alan Lewis

August 31, 2015 at 5:42 am

“this seemed to happen for all events” = meaning the English months and days were used


Lorenzo Orlando Caum

  • Support Staff

August 31, 2015 at 12:09 pm

Hi Alan, are you seeing this issue with Dean’s example as well?


Lorenzo


Alan Lewis

August 31, 2015 at 12:39 pm

Dean’s Example doesn’t work for me – it doesn’t put the date and time on the same line, which is what Bev Hoernig’s solution achieves.

I made it into a plugin but this is what the formatting looks like – all it does is put xxx in front of the date:

xxxSeptember 12, 2016 – September 16, 2016
6:00 pm – 2:00 pm

With the German Version it looks like this:

xxxMai 11, 2016 – Mai 15, 2016
6:00 pm – 2:00 pm


Josh

  • Support Staff

September 1, 2015 at 2:18 pm

Hi Alan,

I used Bev’s code from the other thread that you linked to. Here’s a copy I made into a gist:

https://gist.github.com/joshfeck/9fe4b64da02f042e52b4

I checked again for an event for the month of the May and it has the translated month strings:

https://www.evernote.com/shard/s4/sh/b0c9da43-9ac9-4cec-91a8-8b7f169e2bf5/aaa26c5e7fb55e3bad95e07853794f36

I’m curious about how it’s not translating for you, does the translation start working if you remove the custom code?


Alan Lewis

September 2, 2015 at 9:51 am

Hi Josh

Tried your gist in a plugin – it reformatted the dates OK but put them into English. When I disabled the plugin, it went back to German dates instead.

Would it make any difference that I am have a multisite installation?


Josh

  • Support Staff

September 2, 2015 at 11:37 am

It may be contributing. It seems like it’s a load order issue where possibly your custom function is somehow loading before translations get loaded.

You could try adding the function to the end of the active theme’s functions.php file to see if that makes a difference.


Alan Lewis

September 3, 2015 at 6:11 am

Thanks – I tried that but it still comes out with the formatting OK but not translated. It’s not such a big deal. Thanks for trying to help.

Will you correct the formatting in this way in a future release of EE?


Josh

  • Support Staff

September 3, 2015 at 11:12 am

I don’t think we’ll change the template tag, but it turns out that Event Espresso has another template tag that uses the format you want to be used.

You can use the other tag by copying the content-espresso_events-datetimes.php template from Event Espresso’s /public/Espresso_Arabica_2014 folder into your WordPress theme and then edit your copy where you change the line that reads as:

<?php espresso_list_of_event_dates( $post->ID );?>

to this:

<?php espresso_event_date_range( '', '', '', '', $post->ID ); ?>

-or-

You can change the function in your functions file to simply be:

function espresso_list_of_event_dates() {
    return espresso_event_date_range();
}


Alan Lewis

September 3, 2015 at 12:31 pm

Absolutely Perfect!!! – those two lines of code do the trick perfectly

Many many thanks! Great Support!

Viewing 16 reply threads

The support post ‘Date-Time formatting for multi day events’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso