Displaying Events in Local Time Zones / Events Time Zones

Home Forums Calendar Products Event Aggregator Displaying Events in Local Time Zones / Events Time Zones

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #962905
    Paul
    Participant

    Hi,

    I’ve just run into a fairly major gap in TEC’s featureset which I hope is either being worked on or can be worked around with some tinkering – specifically diplaying events in the viewer’s local time zone and allowing entry of a timezone for events.

    I’m staggered I missed this and that such a seemingly essential feature is missing. I’m hoping that you can help me work through a solution for this if at all possible, I switched from a competitor sporting these features for other reasons and I’d hate to have to switch back.

    Let me know if you can help please.

    Thanks

    #962911
    Barry
    Member

    Hi Paul,

    Introducing timezone support is something we are actively considering, but at this time it is not part of the feature set.

    It might be possible to workaround it with custom or additional fields, though, allowing you to indicate the timezone when you create and edit events. By using suitable hooks, such as tribe_events_event_schedule_details, you could then adjust the time/date information presented to customers appropriately.

    However, at this time I’m afraid it’s the sort of customization we’d really need to leave in your hands as there are many different facets to this.

    Last but not least, please do consider up-voting this existing feature request (it’s already under review, but adding your support is still worthwhile).

    Thanks!

    #963133
    Paul
    Participant

    Thanks Barry, although disappointed to see the feature has been open for over a year and still only ‘under review’. This is an online calendar, the assumption from the get go should have been people will automatically need to specify and control time zones of events.

    Anyway, as I’m going to have to try and workaround this shortcoming, I’m simply going to extend the plugins’s templates to append times in 2 other common timezones (PST and GMT). To do this I need to get at (at the ‘single-event’ and ‘meta’ template level) the current date and time for the event in question, so I can manually programatically convert and append the datetime alongside the ‘default’.

    What function calls are there to do this? Ideally I need the event’s date (on it’s own) and time (on it’s own) returned in some ISO compliant format.

    Thanks.

    #963234
    Barry
    Member

    Hi Paul,

    A great overview of safely customizing our templates can be found within the Themer’s Guide.

    In this case, for instance, you might be interested in overriding the following:

    • single-event.php
    • modules/meta/details.php

    You will probably also be interested in making use of tribe_get_start_date(), basic usage looking something like this:

    tribe_get_start_date( null, false, 'Y-m-d H:i:s' )

    That last parameter controls the date format and it accepts anything that PHP’s date() function does – so you have complete control over the format.

    Does that help here?

    #963252
    Paul
    Participant

    date_default_timezone_set(“America/New_York”);
    $local_start_date = tribe_get_start_date( null, true , ‘y-m-d H:i:s’ );

    $date = new DateTime( $local_start_date );

    // Calculate PST Start DateTime and set var
    $date->setTimezone(new DateTimeZone(‘America/Los_Angeles’));
    $start_datetime_pst = $date->format(‘Y-m-d H:i a’);

    // Calculate GMT Start DateTime and set var
    $date->setTimezone(new DateTimeZone(‘Europe/London’));
    $start_datetime_gmt = $date->format(‘Y-m-d H:i a’);

    // Calculate CEST Start DateTime and set var
    $date->setTimezone(new DateTimeZone(‘Europe/Paris’));
    $start_datetime_cest = $date->format(‘Y-m-d H:i a’);

    print( “PST: ” . $start_datetime_pst . ” GMT: ” . $start_datetime_gmt . ” CEST: ” . $start_datetime_cest );

    In the end I had to settle for displaying a selection of international dates (server is based in EST) and printing them. The above is my customisation of the ‘details’ meta component (not complete here but gives you an idea). It calculates times extrapolated from the event’s EST datetime and prints times in PST, GMT and CEST.

    You guys at minimum should really have a function call which does this – so you call tribe_get_start_date() with a timezone and it returns as required. Doing the above is somewhat laborious.

    #963294
    Barry
    Member

    Glad you got there (and do feel free to add any relevant notes to the existing feature request discussed above, if you haven’t already done so).

    Since I think we’re all set here I will go ahead and close out this topic, but of course please do feel free to post new topics as needed should anything else crop up 🙂

    #965822
    Leah
    Member

    Hi there,

    Thanks again for your post. We wanted to get in touch and let you know that although we weren’t able to address this issue in our upcoming 3.10 release, it is still very much a priority. We have a ticket in our system and will be investigating a solution to be released in a future version. Thank you for your patience and support while we work on this!

    Cheers,
    The Events Calendar Team

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Displaying Events in Local Time Zones / Events Time Zones’ is closed to new replies.