/** * Returns the earliest known event start date, which can be expected to be a string * in MySQL datetime format (unless some other specific format is provided). * * If this is impossible to determine it will return boolean false. * * @param string $format * * @return mixed bool|string */ function tribe_events_earliest_date($format = TribeDateUtils::DBDATETIMEFORMAT) { // Check if the earliest start date is already known $earliest = tribe_get_option('earliest_date', false); if (false !== $earliest) { return TribeDateUtils::reformat($earliest, $format); } // If not, try to determine now TribeEvents::instance()->rebuild_known_range(); $earliest = tribe_get_option('earliest_date', false); if (false !== $earliest) { return TribeDateUtils::reformat($earliest, $format); } return false; }