This filter allows you to customize the complete date and timezone display HTML for meetings and webinars on the frontend.
Description #
This filter is applied in the meeting/webinar single page template when displaying the meeting date and timezone information.
Parameters #
| Parameter | Type | Description |
|---|---|---|
$date_timezone_html | string | The complete HTML output for date and timezone display |
$formatted_date | string | The formatted date string (e.g., “December 27, 2025 10:28 PM”) |
$timezone_display | string | The timezone display string based on settings (e.g., “(GMT-05:00)”, “(GMT-05:00) EST”, or “(GMT-05:00) Eastern Time (US and Canada)”) |
$post_id | int | The meeting or webinar post ID |
$date | DateTime | DateTime object for the meeting start time with timezone |
$time_zone | string | The timezone identifier (e.g., “America/New_York”, “Europe/London”) |
$webinar | bool | Whether this is a webinar (true) or meeting (false) |
Default Output #
By default, the filter outputs:
<b>
December 27, 2025 10:28 PM
<span class="timezone">(GMT-05:00) EST</span>
</b>
The timezone display format depends on the admin settings:
- Offset only:
(GMT-05:00) - Offset with abbreviation:
(GMT-05:00) EST - Offset with full name:
(GMT-05:00) Eastern Time (US and Canada)
Usage Examples #
Example 1: Change Date Format #
add_filter( 'eroom_date_timezone_display', function( $date_timezone_html, $formatted_date, $timezone_display, $post_id, $date, $time_zone, $webinar ) {
// Use a different date format
$custom_date = $date->format( 'l, F j, Y \a\t g:i A' ); // "Monday, December 27, 2025 at 10:28 PM"
return sprintf(
'<b>%s <span class="timezone">%s</span></b>',
esc_html( $custom_date ),
esc_html( $timezone_display )
);
}, 10, 7 );
Example 2: Add Custom Styling #
add_filter( 'eroom_date_timezone_display', function( $date_timezone_html, $formatted_date, $timezone_display, $post_id, $date, $time_zone, $webinar ) {
return sprintf(
'<b class="meeting-datetime">
<span class="date">%s</span>
<span class="timezone highlight">%s</span>
</b>',
esc_html( $formatted_date ),
esc_html( $timezone_display )
);
}, 10, 7 );
Example 3: Show Countdown Timer #
add_filter( 'eroom_date_timezone_display', function( $date_timezone_html, $formatted_date, $timezone_display, $post_id, $date, $time_zone, $webinar ) {
$now = new DateTime();
$interval = $now->diff( $date );
if ( $date > $now ) {
$days_until = $interval->days;
$countdown = sprintf( '(%d days until meeting)', $days_until );
} else {
$countdown = '';
}
return sprintf(
'<b>%s <span class="timezone">%s</span> <span class="countdown">%s</span></b>',
esc_html( $formatted_date ),
esc_html( $timezone_display ),
esc_html( $countdown )
);
}, 10, 7 );
Example 4: Convert to User’s Local Timezone #
add_filter( 'eroom_date_timezone_display', function( $date_timezone_html, $formatted_date, $timezone_display, $post_id, $date, $time_zone, $webinar ) {
// Get user's timezone (you might get this from user meta or browser)
$user_timezone = 'America/Los_Angeles';
try {
$user_date = clone $date;
$user_date->setTimezone( new DateTimeZone( $user_timezone ) );
$user_formatted = $user_date->format( 'F j, Y g:i A' );
$user_offset = $user_date->format( 'P' );
return sprintf(
'<b>
<span class="meeting-time">%s</span>
<span class="timezone">%s</span>
<br>
<small class="your-timezone">Your time: %s (GMT%s)</small>
</b>',
esc_html( $formatted_date ),
esc_html( $timezone_display ),
esc_html( $user_formatted ),
esc_html( $user_offset )
);
} catch ( Exception $e ) {
return $date_timezone_html;
}
}, 10, 7 );
Example 5: Different Display for Webinars vs Meetings #
add_filter( 'eroom_date_timezone_display', function( $date_timezone_html, $formatted_date, $timezone_display, $post_id, $date, $time_zone, $webinar ) {
if ( $webinar ) {
// Special formatting for webinars
return sprintf(
'<b class="webinar-time">
<span class="icon">🎥</span> %s <span class="timezone">%s</span>
</b>',
esc_html( $formatted_date ),
esc_html( $timezone_display )
);
}
// Default formatting for meetings
return $date_timezone_html;
}, 10, 7 );
Example 6: Add iCal Download Link #
add_filter( 'eroom_date_timezone_display', function( $date_timezone_html, $formatted_date, $timezone_display, $post_id, $date, $time_zone, $webinar ) {
$ical_url = add_query_arg( 'ical_export', '1', get_permalink( $post_id ) );
return sprintf(
'<b>
%s <span class="timezone">%s</span>
<a href="%s" class="add-to-calendar" download>📅 Add to Calendar</a>
</b>',
esc_html( $formatted_date ),
esc_html( $timezone_display ),
esc_url( $ical_url )
);
}, 10, 7 );
Important Notes #
- Always use proper escaping functions like
esc_html(),esc_attr(), andesc_url()when outputting data - The
$dateparameter is a PHPDateTimeobject, so you can use all DateTime methods and formatting options - The timezone display respects the admin setting from eRoom → Settings → General Settings → Timezone Display Format
- Make sure to return the filtered value, not echo it
Related #
- Admin Setting: eRoom → Settings → General Settings → Timezone Display Format
- Class Method: `TimezoneHelper::get_display()` – Helper method that generates the timezone display string
