"To" date in eo_format_event_occurrence lacks month…

WordPress Event Management, Calendars & Registration Forums General Question "To" date in eo_format_event_occurrence lacks month…

This topic contains 2 replies, has 2 voices, and was last updated by  Adam Abrams 2 years, 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #40709

    Hi! In my archive template (eo-loop-single-event.php, copied to my child theme from EO templates) I’m using

    echo eo_format_event_occurrence();
    

    to display the date / date range.

    However, when a start and end date are displayed, it shows like this:

    “March 3, 2022 12:00 pm – 13, 2022 10:00 pm”

    I’d like it to say

    “March 3, 2022 12:00 pm – March 13, 2022 10:00 pm”

    I have checked the documentation and see I can add a fourth argument to eo_format_event_occurrence(); to set the date format, but can’t quite wrap my head around how to change this specific thing, i.e. to keep it from dropping the month when the end date is in the same month (which is what I assume is happening).

    Thanks! Adam

    • This topic was modified 2 years, 3 months ago by  Adam Abrams.
    Adam Abrams
    #40711

    Hi Adam,

    That’s the intended behaviour of the function. If the start/end datetime where on the same day it would split it by time (e.g. March 3, 2022 1:00 pm – 3:00 pm)

    To display both dates fully you can do something like:

    $format = "F j, Y g:i a";
    printf("%s  – %s", eo_get_the_start($format), eo_get_the_end($format));
    
    Stephen Harris
    #40713

    Brilliant! Works perfectly! Thanks!

    Adam Abrams
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.