Dates not showing correctly

Home Forums Calendar Products Events Calendar PRO Dates not showing correctly

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1130842
    Joanna Shebson
    Participant

    Times messed up here in the tab: http://prntscr.com/bjz47z http://www.funinjerusalem.com/israel-museum/#events
    Time works on single event: http://www.funinjerusalem.com/event/big-art-little-artist/2016-06-27/
    Here’s the code for the times on the Events tab:
    It used to work, but somewhat recently has stopped working (not sure exactly when)
    Any help is greatly appreciated.
    <?php

    $start_date = tribe_get_start_date($event->ID,true,’F d Y g:H’);
    $end_date = tribe_get_end_date($event->ID,true,’F d Y g:H’);
    $this_event_date = ”;
    $start = new DateTime( $start_date );
    $end = new DateTime( $end_date);

    // Get number of days between by finding seconds between and dividing by # of seconds in a day
    $days = round( ( $end->format( ‘U’ ) – $start->format( ‘U’ ) ) / ( 60 * 60 * 24 ) );

    if ($days == 0 ){
    $end_date = date_format($end, ‘g:i A’);
    }
    if(tribe_event_is_all_day($event->ID)){
    $this_event_date = date_format($start, ‘F d, Y’);
    }
    else{
    $this_event_date = date_format($start, ‘F d Y @ g:H’) . ‘ – ‘ . $end_date;
    }
    ?>

    #1131236
    Andras
    Keymaster

    Hello funinjerusalem,

    I can try to help out here, but I am limited in supporting customizations.

    I think in the first two lines and the last line you are displaying the hour twice: g:H

    Instead try: g:i

    Here is the reference guide for date formatting:

    http://php.net/manual/en/function.date.php

    Let me know if this fixes your issue.

    Cheers,
    Andras

    #1132116
    Joanna Shebson
    Participant

    I tried changing it to g:i which helped but there are still 2 issues:
    http://funevents.illuminea-dev.com/israel-museum/#events
    1. It should say PM but says AM http://prntscr.com/blcpsw
    2. If the start time and end time are the same on the same day, then it should only show once. Now it says 5:00 – 5:00 AM. Should say 5:00 PM

    #1132320
    Andras
    Keymaster

    Hello,

    The AM / PM error doesn’t come from the code, but from how the event timings are set up. Please check if your event timings are set properly to the PM time.

    As for start and end date, you would need to modify your custom code and add somewhere a line that checks this.

    If start and end time are same, then only echo out start time (or end time). Otherwise echo as usual.

    Something like this in the end:
    else{
    if ($start == $ end) {
    $this_event_date = $end_date;
    }
    else {
    $this_event_date = date_format($start, ‘F d Y @ g:H’) . ‘ – ‘ . $end_date;
    }
    }

    Let me know if this solves it for you.

    Cheers,
    Andras

    #1132753
    Joanna Shebson
    Participant

    The PM is set properly in the dashboard: http://prntscr.com/bm0aud
    And you can also see it working fine on single event page: http://funevents.illuminea-dev.com/event/tuesdays-israel-museum/2016-06-28/
    The code you sent produces the following: http://prntscr.com/bm0dfd because of recurring events.
    Thanks.

    #1133713
    Andras
    Keymaster

    Hey funinjerusalem,

    Dang, I thought the last bit is gonna do the trick.

    We are really limited in providing support for and doing customizations.

    I’m sorry, I’m unable to dig into this any further, but I hope this serves as a blueprint to get you or a developer started to fix this.
    Here you can find a list of freelancers, who might be able to take what I done and take it further to get what you need.
    https://theeventscalendar.com/knowledgebase/find-a-customizer/

    I can try to answer some more questions, but have little else beyond what we have already provided.

    Cheers,
    Andras

    #1139755
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Dates not showing correctly’ is closed to new replies.