/** * If it's an all day event and the EOD cutoff is later than midnight * set the end date to be the previous day so it displays correctly in the datepicker * so the datepickers will match. we'll set the correct end time upon saving * * @todo remove this once we're allowed to have all day events without a start/end time */ protected function eod_correction() { $all_day = $this->vars['_EventAllDay']; $end_date = $this->vars['_EventEndDate']; $ends_at_midnight = '23:59:59' === Tribe__Date_Utils::time_only($end_date); $midnight_cutoff = '23:59:59' === Tribe__Date_Utils::time_only(tribe_end_of_day()); if (!$all_day || $ends_at_midnight || $midnight_cutoff) { return; } $end_date = date_create($this->vars['_EventEndDate']); $end_date->modify('-1 day'); $this->vars['_EventEndDate'] = $end_date->format(Tribe__Date_Utils::DBDATETIMEFORMAT); }