You are here

public function FullCalendar::isAllDayEvent in FullCalendar 8.2

Same name and namespace in other branches
  1. 8.5 src/Plugin/views/style/FullCalendar.php \Drupal\fullcalendar\Plugin\views\style\FullCalendar::isAllDayEvent()
  2. 8.4 src/Plugin/views/style/FullCalendar.php \Drupal\fullcalendar\Plugin\views\style\FullCalendar::isAllDayEvent()

Check whether this is an all-day event.

Parameters

array $start_end_date: Array of the start/end dates for the event.

Return value

bool TRUE, if all day, otherwise FALSE.

Throws

\Exception

1 call to FullCalendar::isAllDayEvent()
FullCalendar::prepareEvent in src/Plugin/views/style/FullCalendar.php
Helper method to prepare an event.

File

src/Plugin/views/style/FullCalendar.php, line 630

Class

FullCalendar
Plugin annotation @ViewsStyle( id = "fullcalendar", title = @Translation("FullCalendar"), help = @Translation("Displays items on a calendar."), theme = "views_view--fullcalendar", display_types = {"normal"} )

Namespace

Drupal\fullcalendar\Plugin\views\style

Code

public function isAllDayEvent(array $start_end_date) {
  if (empty($start_end_date['end'])) {
    $allDay = TRUE;
  }
  else {

    // End of start day
    $end = new DateTime($start_end_date['end']);
    $start = new DateTime($start_end_date['start']);
    $start_ymd = $start
      ->format('Y-m-d');
    $start_day_endtime = new DateTime($start_ymd . 'T23:59:59');
    $allDay = $end
      ->getTimestamp() > $start_day_endtime
      ->getTimestamp();
  }
  return $allDay;
}