include_once('wp-content/search-includes/config.php'); include_once('wp-content/search-includes/admin_functions.php'); include_once('wp-content/search-includes/Validate.php'); // --------------------------------------------------------------------------- // IANA timezone map — same as meeting-search-virtual-dev.php // --------------------------------------------------------------------------- function getMeetingIanaMap(): array { return [ 'ACDT' => 'Australia/Adelaide', 'ACST' => 'Australia/Darwin', 'ACWT' => 'Australia/Eucla', 'ADT' => 'America/Halifax', 'ACT' => 'America/Rio_Branco', 'AEDT' => 'Australia/Sydney', 'AEST' => 'Australia/Brisbane', 'AFT' => 'Asia/Kabul', 'AKDT' => 'America/Anchorage', 'AKST' => 'America/Anchorage', 'ALMT' => 'Asia/Almaty', 'AMT' => 'Asia/Yerevan', 'AMST' => 'America/Manaus', 'ANAT' => 'Asia/Anadyr', 'ANAST' => 'Asia/Anadyr', 'AQTT' => 'Asia/Aqtobe', 'ART' => 'America/Argentina/Buenos_Aires', 'AST' => 'America/Halifax', 'AWDT' => 'Australia/Perth', 'AWST' => 'Australia/Perth', 'AZOT' => 'Atlantic/Azores', 'AZOST' => 'Atlantic/Azores', 'AZT' => 'Asia/Baku', 'AZST' => 'Asia/Baku', 'BNT' => 'Asia/Brunei', 'BDT' => 'Asia/Dhaka', 'BOT' => 'America/La_Paz', 'BRT' => 'America/Sao_Paulo', 'BST' => 'Europe/London', 'BTT' => 'Asia/Thimphu', 'BT' => 'Europe/London', 'BGT' => 'Europe/Berlin', 'CAST' => 'Antarctica/Casey', 'CAT' => 'Africa/Harare', 'CCT' => 'Indian/Cocos', 'CEDT' => 'Europe/Paris', 'CEST' => 'Europe/Paris', 'CET' => 'Europe/Belgrade', 'CHADT' => 'Pacific/Chatham', 'CHAST' => 'Pacific/Chatham', 'CHOT' => 'Asia/Choibalsan', 'CHOST' => 'Asia/Choibalsan', 'CHsT' => 'Pacific/Guam', 'CHUT' => 'Pacific/Truk', 'CIT' => 'Asia/Makassar', 'CKT' => 'Pacific/Rarotonga', 'CLST' => 'America/Santiago', 'CLT' => 'America/Santiago', 'COT' => 'America/Bogota', 'CST' => 'America/Chicago', 'CT' => 'America/Chicago', 'CVT' => 'Atlantic/Cape_Verde', 'CWST' => 'Australia/Eucla', 'CXT' => 'Indian/Christmas', 'DAVT' => 'Antarctica/Davis', 'DDUT' => 'Antarctica/DumontDUrville', 'EASST' => 'Pacific/Easter', 'EAST' => 'Pacific/Easter', 'EAT' => 'Africa/Nairobi', 'ECT' => 'America/Guayaquil', 'EDT' => 'America/New_York', 'EEDT' => 'Europe/Helsinki', 'EEST' => 'Europe/Helsinki', 'EET' => 'Europe/Helsinki', 'EGT' => 'America/Scoresbysund', 'EGST' => 'America/Scoresbysund', 'EST' => 'America/New_York', 'ET' => 'America/New_York', 'EIT' => 'Asia/Jayapura', 'FET' => 'Europe/Minsk', 'FJT' => 'Pacific/Fiji', 'FJST' => 'Pacific/Fiji', 'FKST' => 'Atlantic/Stanley', 'FKT' => 'Atlantic/Stanley', 'FNT' => 'America/Noronha', 'GALT' => 'Pacific/Galapagos', 'GAMT' => 'Pacific/Gambier', 'GET' => 'Asia/Tbilisi', 'GFT' => 'America/Cayenne', 'GILT' => 'Pacific/Tarawa', 'GMT' => 'Etc/GMT', 'GST' => 'Asia/Dubai', 'GYT' => 'America/Guyana', 'HADT' => 'America/Adak', 'HAST' => 'America/Adak', 'HKT' => 'Asia/Hong_Kong', 'HOVT' => 'Asia/Hovd', 'HOVST' => 'Asia/Hovd', 'HST' => 'Pacific/Honolulu', 'ICT' => 'Asia/Bangkok', 'IDT' => 'Asia/Jerusalem', 'IOT' => 'Indian/Chagos', 'IRDT' => 'Asia/Tehran', 'IRKT' => 'Asia/Irkutsk', 'IRKST' => 'Asia/Irkutsk', 'IRST' => 'Asia/Tehran', 'IST' => 'Asia/Kolkata', 'IST2' => 'Europe/Dublin', 'JST' => 'Asia/Tokyo', 'KGT' => 'Asia/Bishkek', 'KOST' => 'Pacific/Kosrae', 'KRAT' => 'Asia/Krasnoyarsk', 'KRAST' => 'Asia/Krasnoyarsk', 'KST' => 'Asia/Seoul', 'KUYT' => 'Europe/Samara', 'LHDT' => 'Australia/Lord_Howe', 'LHST' => 'Australia/Lord_Howe', 'LINT' => 'Pacific/Kiritimati', 'LT' => 'Europe/London', 'MAGT' => 'Asia/Magadan', 'MAGST' => 'Asia/Magadan', 'MART' => 'Pacific/Marquesas', 'MAWT' => 'Antarctica/Mawson', 'MDT' => 'America/Denver', 'MeST' => 'America/Metlakatla', 'MHT' => 'Pacific/Majuro', 'MIST' => 'Antarctica/Macquarie', 'MMT' => 'Asia/Rangoon', 'MSD' => 'Europe/Moscow', 'MSK' => 'Europe/Moscow', 'MST' => 'America/Phoenix', 'MT' => 'America/Denver', 'MUT' => 'Indian/Mauritius', 'MVT' => 'Indian/Maldives', 'MYT' => 'Asia/Kuala_Lumpur', 'NCT' => 'Pacific/Noumea', 'NDT' => 'America/St_Johns', 'NFT' => 'Pacific/Norfolk', 'NOVT' => 'Asia/Novosibirsk', 'NOVST' => 'Asia/Novosibirsk', 'NPT' => 'Asia/Kathmandu', 'NRT' => 'Pacific/Nauru', 'NST' => 'America/St_Johns', 'NT' => 'America/St_Johns', 'NUT' => 'Pacific/Niue', 'NZT' => 'Pacific/Auckland', 'NZST' => 'Pacific/Auckland', 'OMST' => 'Asia/Omsk', 'OMSST' => 'Asia/Omsk', 'ORAT' => 'Asia/Oral', 'PDT' => 'America/Los_Angeles', 'PET' => 'America/Lima', 'PETT' => 'Asia/Kamchatka', 'PETST' => 'Asia/Kamchatka', 'PGT' => 'Pacific/Port_Moresby', 'PHT' => 'Asia/Manila', 'PHOT' => 'Pacific/Enderbury', 'PKT' => 'Asia/Karachi', 'PMDT' => 'America/Miquelon', 'PMST' => 'America/Miquelon', 'PONT' => 'Pacific/Pohnpei', 'PORT' => 'Europe/Lisbon', 'PST' => 'America/Los_Angeles', 'PT' => 'America/Los_Angeles', 'PWT' => 'Pacific/Palau', 'PYT' => 'America/Asuncion', 'PYST' => 'America/Asuncion', 'QYZT' => 'Asia/Qyzylorda', 'RET' => 'Indian/Reunion', 'ROTT' => 'Antarctica/Rothera', 'SAKT' => 'Asia/Sakhalin', 'SAMT' => 'Europe/Samara', 'SAST' => 'Africa/Johannesburg', 'SBT' => 'Pacific/Guadalcanal', 'SCT' => 'Indian/Mahe', 'SGT' => 'Asia/Singapore', 'SLT' => 'Asia/Colombo', 'SLST' => 'Asia/Colombo', 'SRT' => 'America/Paramaribo', 'SRET' => 'Asia/Srednekolymsk', 'SST' => 'Pacific/Pago_Pago', 'SYOT' => 'Antarctica/Syowa', 'TAHT' => 'Pacific/Tahiti', 'TFT' => 'Indian/Kerguelen', 'TJT' => 'Asia/Dushanbe', 'TKT' => 'Pacific/Fakaofo', 'TLT' => 'Asia/Dili', 'TMT' => 'Asia/Ashgabat', 'TOT' => 'Pacific/Tongatapu', 'TRT' => 'Europe/Istanbul', 'TRUT' => 'Pacific/Truk', 'TVT' => 'Pacific/Funafuti', 'ULAT' => 'Asia/Ulaanbaatar', 'ULAST' => 'Asia/Ulaanbaatar', 'UTC' => 'UTC', 'UYST' => 'America/Montevideo', 'UYT' => 'America/Montevideo', 'UZT' => 'Asia/Tashkent', 'VET' => 'America/Caracas', 'VLAT' => 'Asia/Vladivostok', 'VLAST' => 'Asia/Vladivostok', 'VOLT' => 'Europe/Volgograd', 'VUT' => 'Pacific/Efate', 'WAKT' => 'Pacific/Wake', 'WAT' => 'Africa/Lagos', 'WAST' => 'Africa/Windhoek', 'WDT' => 'Australia/Perth', 'WEDT' => 'Europe/Lisbon', 'WEST' => 'Europe/Lisbon', 'WET' => 'Europe/Lisbon', 'WFT' => 'Pacific/Wallis', 'WGT' => 'America/Godthab', 'WGST' => 'America/Godthab', 'WIB' => 'Asia/Jakarta', 'WIT' => 'Asia/Jayapura', 'WITA' => 'Asia/Makassar', 'WST' => 'Australia/Perth', 'WT' => 'Africa/Monrovia', 'YAKT' => 'Asia/Yakutsk', 'YAKST' => 'Asia/Yakutsk', 'YAP' => 'Pacific/Truk', 'YEKT' => 'Asia/Yekaterinburg', 'YEKST' => 'Asia/Yekaterinburg', ]; } // --------------------------------------------------------------------------- // Convert a meeting time (meeting-local tz) to the user's timezone. // Returns [userDayName, userTime H:i:s, userDayNum, localDayName, dayShifted Y/N] // --------------------------------------------------------------------------- function convertToUserTime( string $meetingDay, string $meetingTime, string $meetingTzCode, DateTimeZone $userTz ): array { static $ianaMap = null; if ($ianaMap === null) { $ianaMap = getMeetingIanaMap(); } $dayNames = [ 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday', 7 => 'Sunday', ]; $ianaName = $ianaMap[$meetingTzCode] ?? 'UTC'; $meetingTz = new DateTimeZone($ianaName); $dt = new DateTime($meetingDay . ' ' . $meetingTime, $meetingTz); $origDayNum = (int) $dt->format('N'); $dt->setTimezone($userTz); $userDayNum = (int) $dt->format('N'); return [ 0 => $dayNames[$userDayNum], 1 => $dt->format('H:i:s'), 2 => $userDayNum, 3 => $dayNames[$origDayNum], 4 => ($userDayNum !== $origDayNum) ? 'Y' : 'N', ]; } // --------------------------------------------------------------------------- // Given a user-local weekday name and time (H:i:s), return the next DateTime // on or after $now when that meeting occurs. If the slot already passed this // week, returns the occurrence next week. // --------------------------------------------------------------------------- function nextOccurrence(string $dayName, string $timeStr, DateTime $now): DateTime { $dayNums = ['Monday'=>1,'Tuesday'=>2,'Wednesday'=>3,'Thursday'=>4, 'Friday'=>5,'Saturday'=>6,'Sunday'=>7]; $targetNum = $dayNums[$dayName] ?? 1; $todayNum = (int) $now->format('N'); $diff = ($targetNum - $todayNum + 7) % 7; [$h, $i, $s] = array_pad(explode(':', $timeStr), 3, '00'); $dt = clone $now; if ($diff > 0) { $dt->modify("+{$diff} days"); } $dt->setTime((int)$h, (int)$i, (int)$s); // If this slot has already passed today, jump to next week if ($dt < $now) { $dt->modify('+7 days'); } return $dt; } // --------------------------------------------------------------------------- // First-visit: browser hasn't told us the IANA timezone yet. // Output a lightweight redirect page before any WordPress theme HTML fires. // --------------------------------------------------------------------------- $userTzName = clean_request($_GET, 'mytimezone', 'basic', 100); if ($userTzName === '') { $baseUrl = 'https://' . $_SERVER['HTTP_HOST'] . strtok($_SERVER['REQUEST_URI'], '?') . '?mytimezone='; ?>
Detecting your timezone — if this page does not redirect within 5 seconds, click here.
modify('+24 hours'); // Normal page load from here on. get_header(); ?> where('status', 'Active'); $rawData = $db->get('groups_live g', null, $cols); // --------------------------------------------------------------------------- // For each meeting row, determine venue fields, convert times, find next // occurrence, and keep those that fall within the 24-hour window. // Multi-day meetings generate one entry per qualifying day. // --------------------------------------------------------------------------- $results = []; foreach ($rawData as $row) { $startTime = null; $endTime = null; $tzCode = null; $daysStr = ''; $venueLabel = ''; $originates = ''; switch ($row['primary_venue']) { case 'Video': $startTime = $row['vid_start_time'] ?? null; $endTime = $row['vid_end_time'] ?? null; $tzCode = $row['vid_time_zone'] ?? null; $daysStr = $row['vid_meeting_day'] ?? ''; $venueLabel = 'Video'; $originates = trim(($row['vid_host_location'] ?? '') . ' ' . ($row['vid_host_country'] ?? '')); break; case 'Phone': $startTime = $row['phone_start_time'] ?? null; $endTime = $row['phone_end_time'] ?? null; $tzCode = $row['phone_time_zone'] ?? null; $daysStr = $row['phone_meeting_day'] ?? ''; $venueLabel = 'Phone'; $originates = trim(($row['phone_host_location'] ?? '') . ' ' . ($row['phone_host_country'] ?? '')); break; case 'Email': if (($row['email_specifictime'] ?? '') === 'no') continue 2; $startTime = $row['email_start_time'] ?? null; $endTime = $row['email_end_time'] ?? null; $tzCode = $row['email_time_zone'] ?? null; $daysStr = $row['email_meeting_day'] ?? ''; $venueLabel = 'Email/Chat'; break; case 'F2F': $startTime = $row['f2f_start_time'] ?? null; $endTime = $row['f2f_end_time'] ?? null; $tzCode = $row['master_time_zone'] ?? null; // F2F uses master tz $daysStr = $row['f2f_meeting_day'] ?? ''; $venueLabel = 'Face-to-face'; $originates = trim(($row['f2f_city'] ?? '') . ' ' . ($row['f2f_state'] ?? '')); break; default: continue 2; } if (!$startTime || !$endTime || !$tzCode || $daysStr === '') continue; $days = array_filter(array_map('trim', explode(',', $daysStr))); if (empty($days)) continue; foreach ($days as $meetingDay) { $convStart = convertToUserTime($meetingDay, $startTime, $tzCode, $userTz); $convEnd = convertToUserTime($meetingDay, $endTime, $tzCode, $userTz); $userDayName = $convStart[0]; $userTimeStr = $convStart[1]; $localDay = $convStart[3]; // meeting-local day name $dayShifted = $convStart[4]; $nextOcc = nextOccurrence($userDayName, $userTimeStr, $nowUser); // Skip if outside the 24-hour window if ($nextOcc > $cutoffUser) continue; $results[] = [ 'next_occ' => $nextOcc, 'user_day' => $userDayName, 'user_start' => $userTimeStr, 'user_end' => $convEnd[1], 'local_day' => $localDay, 'local_start' => $startTime, 'local_end' => $endTime, 'tz_code' => $tzCode, 'day_shifted' => $dayShifted, 'venue_label' => $venueLabel, 'originates' => $originates, 'row' => $row, ]; } } // Sort by next occurrence ascending (soonest first) usort($results, fn($a, $b) => $a['next_occ'] <=> $b['next_occ']); // Pre-load timezone descriptions for all tz codes we actually use $allTzCodes = array_unique(array_filter(array_column($results, 'tz_code'))); $tzDescMap = []; if (!empty($allTzCodes)) { $db->where('tz_code', $allTzCodes, 'IN'); foreach ($db->get('timezones_wshift') as $tzRow) { $tzDescMap[$tzRow['tz_code']] = $tzRow['tz_description']; } } ?>meeting(s) found.
Slide results side-to-side to see all columns.