• Resolved jshare

    (@jshare)


    Hi
    I’m trying to setup custom start and end time placeholders in ISO 8601 format.

    That should be as simple as #c and #@c, according to the docs.

    However, when I use them in the Single event page format, it appears in the correct format but the timezone is my WordPress default, and not the timezone of the event.

    For example, my WordPress default is UTC+3 currently due to DST. I have a test event that is UTC+8.

    If I use #c, I get 2020-05-05T13:00:00+03:00 when I was expecting 2020-05-05T13:00:00+08:00.

    If I hack classes\em-event.php – which I prefer not to do, the docs’ solution is much more elegant and needs no maintenance – I can add a case such as:

    case '#_EVENTISO8601STARTDATE':
    	$replace = $this->start()->format('c');
    	break;

    Using #_EVENTISO8601STARTDATE gives 2020-05-05T13:00:00+08:00.

    Is this a bug or something else?

    Thanks for an amazing plugin

    Jacob

Viewing 1 replies (of 1 total)
  • Hello,

    Here’s a sample placeholder that dispalys the EVENTENDDATE. I think this might help you get started on what you’re looking for and just modify it to show the correct format you’re looking:

    add_filter( 'em_event_output_placeholder', 'theme_custom_placeholders',1 ,3 );
    
    function theme_custom_placeholders( $replace, $EM_Event, $result ){
    
    	// Placeholder to get total of lunch Bookings
    	if( $result == '#_EVENTENDDATE' ){
    		$replace = '';
    		$date_format = '';
    		if( $EM_Event-> event_end_date ) {
    			if( empty($date_format) ) $date_format = ( get_option('dbem_date_format') ) ? get_option('dbem_date_format'):get_option('date_format');
    			$replace = $EM_Event->end()->i18n( $date_format );
    		}
    
    	}
    
    	return $replace;
    }
    
    //Alternatively you can try the following below as replace code.
    //$EM_Event->start()->format('g:i A'):$EM_Event->end()->format('g:i A');

    Please do note also that it may show a different time depending on your Event Timezone Settings.

    • This reply was modified 4 years, 10 months ago by timrv.
Viewing 1 replies (of 1 total)
  • The topic ‘Custom time placeholder timezone issue?’ is closed to new replies.